Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _CTRLBOX_HXX
30 : : #define _CTRLBOX_HXX
31 : :
32 : : #include "svtools/svtdllapi.h"
33 : :
34 : : #include <tools/string.hxx>
35 : : #include <vcl/lstbox.hxx>
36 : : #include <vcl/combobox.hxx>
37 : : #include <vcl/image.hxx>
38 : : #include <vcl/virdev.hxx>
39 : : #include <vcl/metric.hxx>
40 : : #include <vcl/field.hxx>
41 : :
42 : : class FontList;
43 : : class ImplColorListData;
44 : : class ImpLineListData;
45 : : class ImplFontNameListData;
46 : :
47 : : typedef ::std::vector< ImplColorListData* > ImpColorList;
48 : : typedef ::std::vector< ImpLineListData* > ImpLineList;
49 : : typedef ::std::vector< ImplFontNameListData* > ImplFontList;
50 : :
51 : : // FIXME: STYLE_* duplicate values from editeng::SvxBorderStyle,
52 : : // which in turn duplicates values from com::sun::star::table::BorderLineStyle:
53 : : // this needs cleaning up on master
54 : : #define STYLE_SOLID ( ( sal_uInt16 ) 0 )
55 : : #define STYLE_DOTTED ( ( sal_uInt16 ) 1 )
56 : : #define STYLE_DASHED ( ( sal_uInt16 ) 2 )
57 : : #define STYLE_NONE ( ( sal_uInt16 ) -1)
58 : :
59 : : #define CHANGE_LINE1 ( ( sal_uInt16 ) 1 )
60 : : #define CHANGE_LINE2 ( ( sal_uInt16 ) 2 )
61 : : #define CHANGE_DIST ( ( sal_uInt16 ) 4 )
62 : : #define ADAPT_DIST ( ( sal_uInt16 ) 8 )
63 : :
64 : :
65 : :
66 : : /*************************************************************************
67 : :
68 : : Beschreibung
69 : : ============
70 : :
71 : : class ColorListBox
72 : :
73 : : Beschreibung
74 : :
75 : : Erlaubt die Auswahl von Farben.
76 : :
77 : : --------------------------------------------------------------------------
78 : :
79 : : class LineListBox
80 : :
81 : : Beschreibung
82 : :
83 : : Erlaubt die Auswahl von Linien-Styles und Groessen. Es ist darauf zu achten,
84 : : das vor dem ersten Insert die Units und die Fesntergroesse gesetzt sein
85 : : muessen. An Unit wird Point und mm unterstuetzt und als SourceUnit Point,
86 : : mm und Twips. Alle Angaben muessen in 100teln der jeweiligen Einheit
87 : : vorliegen.
88 : :
89 : : Line1 ist aeussere, Line2 die innere und Distance die Distanz zwischen
90 : : den beiden Linien. Wenn Line2 = 0 ist, wird nur Line1 angezeigt. Als
91 : : Default sind sowohl Source als auch Ziel-Unit FUNIT_POINT.
92 : :
93 : : Mit SetColor() kann die Linienfarbe eingestellt werden.
94 : :
95 : : Anmerkungen und Ausnahmen
96 : :
97 : : Gegenueber einer normalen ListBox, koennen keine User-Daten gesetzt
98 : : werden. Ausserdem sollte wenn der UpdateMode ausgeschaltet ist, keine
99 : : Daten abgefragt oder die Selektion gesetzt werden, da in diesem Zustand
100 : : die Daten nicht definiert sind. Wenn der UpdateMode ausgeschaltet ist,
101 : : sollte der Rueckgabewert bei Insert nicht ausgewertet werden, da er keine
102 : : Bedeutung hat. Ausserdem darf nicht das WinBit WB_SORT gesetzt sein.
103 : :
104 : : --------------------------------------------------------------------------
105 : :
106 : : class FontNameBox
107 : :
108 : : Beschreibung
109 : :
110 : : Erlaubt die Auswahl von Fonts. Die ListBox wird mit Fill gefuellt, wo
111 : : ein Pointer auf eine FontList uebergeben werden muss.
112 : :
113 : : Mit EnableWYSIWYG() kann man einstellen, das die Fontnamen in Ihrer Schrift
114 : : angezeigt werden und mit EnableSymbols() kann eingestellt werden, das
115 : : vor dem Namen ueber ein Symbol angezeigt wird, ob es sich um eine
116 : : Drucker oder Bildschirmschrift handelt.
117 : :
118 : : Querverweise
119 : :
120 : : FontList; FontStyleBox; FontSizeBox; FontNameMenu
121 : :
122 : : --------------------------------------------------------------------------
123 : :
124 : : class FontStyleBox
125 : :
126 : : Beschreibung
127 : :
128 : : Erlaubt die Auswahl eines FontStyles. Mit Fill wird die ListBox mit
129 : : den Styles zum uebergebenen Font gefuellt. Nachgebildete Styles werden
130 : : immer mit eingefuegt (kann sich aber noch aendern, da vielleicht
131 : : nicht alle Applikationen [StarDraw,Formel,FontWork] mit Syntetic-Fonts
132 : : umgehen koennen). Bei Fill bleibt vorherige Name soweit wie moeglich
133 : : erhalten.
134 : :
135 : : Fuer DontKnow sollte die FontStyleBox mit String() gefuellt werden.
136 : : Dann enthaellt die Liste die Standardattribute. Der Style, der gerade
137 : : angezeigt wird, muss gegebenenfalls noch vom Programm zurueckgesetzt werden.
138 : :
139 : : Querverweise
140 : :
141 : : FontList; FontNameBox; FontSizeBox;
142 : :
143 : : --------------------------------------------------------------------------
144 : :
145 : : class FontSizeBox
146 : :
147 : : Beschreibung
148 : :
149 : : Erlaubt die Auswahl von Fontgroessen. Werte werden ueber GetValue()
150 : : abgefragt und ueber SetValue() gesetzt. Fill fuellt die ListBox mit den
151 : : Groessen zum uebergebenen Font. Alle Groessen werden in 10tel Point
152 : : angegeben. Die FontListe, die bei Fill uebergeben wird, muss bis zum
153 : : naechsten Fill-Aufruf erhalten bleiben.
154 : :
155 : : Zusaetzlich erlaubt die FontSizeBox noch einen Relative-Mode. Dieser
156 : : dient dazu, Prozent-Werte eingeben zu koennen. Dies kann zum Beispiel
157 : : nuetzlich sein, wenn man die Box in einem Vorlagen-Dialog anbietet.
158 : : Dieser Modus ist nur anschaltbar, jedoch nicht wieder abschaltbar.
159 : :
160 : : Fuer DontKnow sollte die FontSizeBox mit FontInfo() gefuellt werden.
161 : : Dann enthaellt die Liste die Standardgroessen. Die Groesse, die gerade
162 : : angezeigt wird, muss gegebenenfalls noch vom Programm zurueckgesetzt werden.
163 : :
164 : : Querverweise
165 : :
166 : : FontList; FontNameBox; FontStyleBox; FontSizeMenu
167 : :
168 : : *************************************************************************/
169 : :
170 : : // ----------------
171 : : // - ColorListBox -
172 : : // ----------------
173 : :
174 : : class SVT_DLLPUBLIC ColorListBox : public ListBox
175 : : {
176 : : ImpColorList* pColorList; // Separate Liste, falls UserDaten von aussen verwendet werden.
177 : : Size aImageSize;
178 : :
179 : : #ifdef _CTRLBOX_CXX
180 : : using Window::ImplInit;
181 : : SVT_DLLPRIVATE void ImplInit();
182 : : SVT_DLLPRIVATE void ImplDestroyColorEntries();
183 : : #endif
184 : : public:
185 : : ColorListBox( Window* pParent,
186 : : WinBits nWinStyle = WB_BORDER );
187 : : ColorListBox( Window* pParent, const ResId& rResId );
188 : : virtual ~ColorListBox();
189 : :
190 : : virtual void UserDraw( const UserDrawEvent& rUDEvt );
191 : :
192 : : using ListBox::InsertEntry;
193 : : virtual sal_uInt16 InsertEntry( const XubString& rStr,
194 : : sal_uInt16 nPos = LISTBOX_APPEND );
195 : : virtual sal_uInt16 InsertEntry( const Color& rColor, const XubString& rStr,
196 : : sal_uInt16 nPos = LISTBOX_APPEND );
197 : : void InsertAutomaticEntryColor(const Color &rAutoColorValue);
198 : 0 : bool IsAutomaticSelected() { return !GetSelectEntryPos(); }
199 : : using ListBox::RemoveEntry;
200 : : virtual void RemoveEntry( sal_uInt16 nPos );
201 : : virtual void Clear();
202 : : void CopyEntries( const ColorListBox& rBox );
203 : :
204 : : using ListBox::GetEntryPos;
205 : : virtual sal_uInt16 GetEntryPos( const Color& rColor ) const;
206 : : virtual Color GetEntryColor( sal_uInt16 nPos ) const;
207 : : Size GetImageSize() const { return aImageSize; }
208 : :
209 : 203 : void SelectEntry( const XubString& rStr, sal_Bool bSelect = sal_True )
210 : 203 : { ListBox::SelectEntry( rStr, bSelect ); }
211 : : void SelectEntry( const Color& rColor, sal_Bool bSelect = sal_True );
212 : 0 : XubString GetSelectEntry( sal_uInt16 nSelIndex = 0 ) const
213 : 0 : { return ListBox::GetSelectEntry( nSelIndex ); }
214 : : Color GetSelectEntryColor( sal_uInt16 nSelIndex = 0 ) const;
215 : 0 : sal_Bool IsEntrySelected( const XubString& rStr ) const
216 : 0 : { return ListBox::IsEntrySelected( rStr ); }
217 : :
218 : : sal_Bool IsEntrySelected( const Color& rColor ) const;
219 : :
220 : : private:
221 : : // declared as private because some compilers would generate the default functions
222 : : ColorListBox( const ColorListBox& );
223 : : ColorListBox& operator =( const ColorListBox& );
224 : :
225 : : void SetEntryData( sal_uInt16 nPos, void* pNewData );
226 : : void* GetEntryData( sal_uInt16 nPos ) const;
227 : : };
228 : :
229 : 260 : inline void ColorListBox::SelectEntry( const Color& rColor, sal_Bool bSelect )
230 : : {
231 : 260 : sal_uInt16 nPos = GetEntryPos( rColor );
232 [ + + ]: 260 : if ( nPos != LISTBOX_ENTRY_NOTFOUND )
233 : 252 : ListBox::SelectEntryPos( nPos, bSelect );
234 : 260 : }
235 : :
236 : 0 : inline sal_Bool ColorListBox::IsEntrySelected( const Color& rColor ) const
237 : : {
238 : 0 : sal_uInt16 nPos = GetEntryPos( rColor );
239 : 0 : if ( nPos != LISTBOX_ENTRY_NOTFOUND )
240 : 0 : return IsEntryPosSelected( nPos );
241 : : else
242 : 0 : return sal_False;
243 : : }
244 : :
245 : 288 : inline Color ColorListBox::GetSelectEntryColor( sal_uInt16 nSelIndex ) const
246 : : {
247 : 288 : sal_uInt16 nPos = GetSelectEntryPos( nSelIndex );
248 : 288 : Color aColor;
249 [ + - ]: 288 : if ( nPos != LISTBOX_ENTRY_NOTFOUND )
250 : 288 : aColor = GetEntryColor( nPos );
251 : 288 : return aColor;
252 : : }
253 : :
254 : : // ---------------
255 : : // - LineListBox -
256 : : // ---------------
257 : :
258 : : /**
259 : : Class computing border widths shared between Line style listbox and the
260 : : SvxBorderLine implementation.
261 : :
262 : : This class doesn't know anything about units: it all depends on the different
263 : : values set. A border is composed of 2 lines separated by a gap. The computed
264 : : widths are the ones of each line and the gap and they can either be fix or vary.
265 : :
266 : : The #m_nflags member will define which widths will vary (value 0 means that all
267 : : widths are fixed). The available flags are:
268 : : - CHANGE_LINE1
269 : : - CHANGE_LINE2
270 : : - CHANGE_DIST
271 : :
272 : : For each line, the rate member is used as a multiplication factor is the width
273 : : isn't fixed. Otherwise it is the width in the unit expected by the client code.
274 : : */
275 : : class SVT_DLLPUBLIC BorderWidthImpl
276 : : {
277 : : sal_uInt16 m_nFlags;
278 : : double m_nRate1;
279 : : double m_nRate2;
280 : : double m_nRateGap;
281 : :
282 : : public:
283 : :
284 : : BorderWidthImpl( sal_uInt16 nFlags = CHANGE_LINE1, double nRate1 = 0.0,
285 : : double nRate2 = 0.0, double nRateGap = 0.0 );
286 : :
287 : : BorderWidthImpl& operator= ( const BorderWidthImpl& r );
288 : : bool operator== ( const BorderWidthImpl& r ) const;
289 : :
290 : : long GetLine1 ( long nWidth ) const;
291 : : long GetLine2( long nWidth ) const;
292 : : long GetGap( long nWidth ) const;
293 : :
294 : : long GuessWidth( long nLine1, long nLine2, long nGap );
295 : :
296 [ - + ][ # # ]: 6156 : bool IsEmpty( ) const { return (0 == m_nRate1) && (0 == m_nRate2); }
297 [ + - ][ + + ]: 130107 : bool IsDouble( ) const { return (0 != m_nRate1) && (0 != m_nRate2); }
298 : : };
299 : :
300 : 0 : SVT_DLLPUBLIC inline Color sameColor( Color rMain )
301 : : {
302 : 0 : return rMain;
303 : : }
304 : :
305 : 0 : SVT_DLLPUBLIC inline Color sameDistColor( Color /*rMain*/, Color rDefault )
306 : : {
307 : 0 : return rDefault;
308 : : }
309 : :
310 : :
311 : : class SVT_DLLPUBLIC LineListBox : public ListBox
312 : : {
313 : : ImpLineList* pLineList;
314 : : long m_nWidth;
315 : : XubString m_sNone;
316 : :
317 : : VirtualDevice aVirDev;
318 : : Size aTxtSize;
319 : : Color aColor;
320 : : Color maPaintCol;
321 : : FieldUnit eUnit;
322 : : FieldUnit eSourceUnit;
323 : :
324 : : SVT_DLLPRIVATE void ImpGetLine( long nLine1, long nLine2, long nDistance,
325 : : Color nColor1, Color nColor2, Color nColorDist,
326 : : sal_uInt16 nStyle, Bitmap& rBmp );
327 : : using Window::ImplInit;
328 : : SVT_DLLPRIVATE void ImplInit();
329 : : sal_Bool UpdatePaintLineColor( void ); // returns sal_True if maPaintCol has changed
330 : : virtual void DataChanged( const DataChangedEvent& rDCEvt );
331 : :
332 : : void UpdateEntries( long nOldWidth );
333 : : sal_uInt16 GetStylePos( sal_uInt16 nListPos, long nWidth );
334 : :
335 : : public:
336 : : LineListBox( Window* pParent, WinBits nWinStyle = WB_BORDER );
337 : : LineListBox( Window* pParent, const ResId& rResId );
338 : : virtual ~LineListBox();
339 : :
340 : : /** Set the width in Twips */
341 : : void SetWidth( long nWidth );
342 : : void SetNone( const XubString& sNone );
343 : :
344 : : using ListBox::InsertEntry;
345 : : virtual sal_uInt16 InsertEntry( const XubString& rStr, sal_uInt16 nPos = LISTBOX_APPEND );
346 : : /** Insert a listbox entry with all widths in Twips. */
347 : : void InsertEntry( BorderWidthImpl aWidthImpl,
348 : : sal_uInt16 nStyle, long nMinWidth = 0,
349 : : Color (*pColor1Fn)(Color) = &sameColor,
350 : : Color (*pColor2Fn)( Color ) = &sameColor,
351 : : Color (*pColorDistFn)( Color, Color ) = &sameDistColor );
352 : :
353 : : using ListBox::RemoveEntry;
354 : : virtual void RemoveEntry( sal_uInt16 nPos );
355 : : virtual void Clear();
356 : :
357 : : using ListBox::GetEntryPos;
358 : : virtual sal_uInt16 GetEntryPos( sal_uInt16 nStyle = STYLE_SOLID ) const;
359 : : sal_uInt16 GetEntryStyle( sal_uInt16 nPos ) const;
360 : :
361 : 0 : void SelectEntry( const XubString& rStr, sal_Bool bSelect = sal_True ) { ListBox::SelectEntry( rStr, bSelect ); }
362 : : void SelectEntry( sal_uInt16 nStyle = STYLE_SOLID, sal_Bool bSelect = sal_True );
363 : : sal_uInt16 GetSelectEntryStyle( sal_uInt16 nSelIndex = 0 ) const;
364 : 0 : inline sal_Bool IsEntrySelected( const XubString& rStr ) const { return ListBox::IsEntrySelected( rStr ); }
365 : : sal_Bool IsEntrySelected( sal_uInt16 nStyle1 = STYLE_SOLID ) const;
366 : :
367 : 0 : inline void SetUnit( FieldUnit eNewUnit ) { eUnit = eNewUnit; }
368 : : inline FieldUnit GetUnit() const { return eUnit; }
369 : 0 : inline void SetSourceUnit( FieldUnit eNewUnit ) { eSourceUnit = eNewUnit; }
370 : : inline FieldUnit GetSourceUnit() const { return eSourceUnit; }
371 : :
372 : : void SetColor( const Color& rColor );
373 : : inline Color GetColor( void ) const;
374 : :
375 : : protected:
376 : :
377 : : inline const Color& GetPaintColor( void ) const;
378 : : Color GetColorLine1( sal_uInt16 nPos = 0 );
379 : : Color GetColorLine2( sal_uInt16 nPos = 0 );
380 : : Color GetColorDist( sal_uInt16 nPos = 0 );
381 : :
382 : : private:
383 : : // declared as private because some compilers would generate the default methods
384 : : LineListBox( const LineListBox& );
385 : : LineListBox& operator =( const LineListBox& );
386 : : void SetEntryData( sal_uInt16 nPos, void* pNewData );
387 : : void* GetEntryData( sal_uInt16 nPos ) const;
388 : : };
389 : :
390 : : inline sal_Bool LineListBox::IsEntrySelected( sal_uInt16 nStyle ) const
391 : : {
392 : : sal_uInt16 nPos = GetEntryPos( nStyle );
393 : : if ( nPos != LISTBOX_ENTRY_NOTFOUND )
394 : : return IsEntryPosSelected( nPos );
395 : : else
396 : : return sal_False;
397 : : }
398 : :
399 : 0 : inline void LineListBox::SetColor( const Color& rColor )
400 : : {
401 : 0 : aColor = rColor;
402 : :
403 : 0 : UpdateEntries( m_nWidth );
404 : 0 : }
405 : :
406 : 0 : inline Color LineListBox::GetColor( void ) const
407 : : {
408 : 0 : return aColor;
409 : : }
410 : :
411 : 0 : const Color& LineListBox::GetPaintColor( void ) const
412 : : {
413 : 0 : return maPaintCol;
414 : : }
415 : :
416 : 0 : inline void LineListBox::SetWidth( long nWidth )
417 : : {
418 : 0 : long nOldWidth = m_nWidth;
419 : 0 : m_nWidth = nWidth;
420 : 0 : UpdateEntries( nOldWidth );
421 : 0 : }
422 : :
423 : 0 : inline void LineListBox::SetNone( const XubString& sNone )
424 : : {
425 : 0 : m_sNone = sNone;
426 : 0 : }
427 : :
428 : : // ---------------
429 : : // - FontNameBox -
430 : : // ---------------
431 : :
432 : : class SVT_DLLPUBLIC FontNameBox : public ComboBox
433 : : {
434 : : private:
435 : : ImplFontList* mpFontList;
436 : : Image maImagePrinterFont;
437 : : Image maImageBitmapFont;
438 : : Image maImageScalableFont;
439 : : sal_Bool mbWYSIWYG;
440 : : sal_Bool mbSymbols;
441 : : String maFontMRUEntriesFile;
442 : :
443 : : #ifdef _CTRLBOX_CXX
444 : : SVT_DLLPRIVATE void ImplCalcUserItemSize();
445 : : SVT_DLLPRIVATE void ImplDestroyFontList();
446 : : #endif
447 : :
448 : : void InitBitmaps( void );
449 : : protected:
450 : : virtual void DataChanged( const DataChangedEvent& rDCEvt );
451 : : void LoadMRUEntries( const String& aFontMRUEntriesFile, xub_Unicode cSep = ';' );
452 : : void SaveMRUEntries( const String& aFontMRUEntriesFile, xub_Unicode cSep = ';' ) const;
453 : : public:
454 : : FontNameBox( Window* pParent,
455 : : WinBits nWinStyle = WB_SORT );
456 : : FontNameBox( Window* pParent, const ResId& rResId );
457 : : virtual ~FontNameBox();
458 : :
459 : : virtual void UserDraw( const UserDrawEvent& rUDEvt );
460 : :
461 : : void Fill( const FontList* pList );
462 : :
463 : : void EnableWYSIWYG( sal_Bool bEnable = sal_True );
464 : : sal_Bool IsWYSIWYGEnabled() const { return mbWYSIWYG; }
465 : :
466 : : void EnableSymbols( sal_Bool bEnable = sal_True );
467 : : sal_Bool IsSymbolsEnabled() const { return mbSymbols; }
468 : :
469 : : private:
470 : : void InitFontMRUEntriesFile();
471 : :
472 : : // declared as private because some compilers would generate the default functions
473 : : FontNameBox( const FontNameBox& );
474 : : FontNameBox& operator =( const FontNameBox& );
475 : : };
476 : :
477 : : // ----------------
478 : : // - FontStyleBox -
479 : : // ----------------
480 : :
481 : : class SVT_DLLPUBLIC FontStyleBox : public ComboBox
482 : : {
483 : : XubString aLastStyle;
484 : :
485 : : private:
486 : : using ComboBox::SetText;
487 : : public:
488 : : FontStyleBox( Window* pParent, const ResId& rResId );
489 : : virtual ~FontStyleBox();
490 : :
491 : : virtual void Select();
492 : : virtual void LoseFocus();
493 : : virtual void Modify();
494 : :
495 : : void SetText( const XubString& rText );
496 : : void Fill( const XubString& rName, const FontList* pList );
497 : :
498 : : private:
499 : : // declared as private because some compilers would generate the default functions
500 : : FontStyleBox( const FontStyleBox& );
501 : : FontStyleBox& operator =( const FontStyleBox& );
502 : : };
503 : :
504 : 0 : inline void FontStyleBox::SetText( const XubString& rText )
505 : : {
506 : 0 : aLastStyle = rText;
507 : 0 : ComboBox::SetText( rText );
508 : 0 : }
509 : :
510 : : // ---------------
511 : : // - FontSizeBox -
512 : : // ---------------
513 : :
514 : : class SVT_DLLPUBLIC FontSizeBox : public MetricBox
515 : : {
516 : : FontInfo aFontInfo;
517 : : const FontList* pFontList;
518 : : sal_uInt16 nRelMin;
519 : : sal_uInt16 nRelMax;
520 : : sal_uInt16 nRelStep;
521 : : short nPtRelMin;
522 : : short nPtRelMax;
523 : : short nPtRelStep;
524 : : sal_Bool bRelativeMode:1,
525 : : bRelative:1,
526 : : bPtRelative:1,
527 : : bStdSize:1;
528 : :
529 : : #ifdef _CTRLBOX_CXX
530 : : using Window::ImplInit;
531 : : SVT_DLLPRIVATE void ImplInit();
532 : : #endif
533 : :
534 : : protected:
535 : : virtual XubString CreateFieldText( sal_Int64 nValue ) const;
536 : :
537 : : public:
538 : : FontSizeBox( Window* pParent, WinBits nWinStyle = 0 );
539 : : FontSizeBox( Window* pParent, const ResId& rResId );
540 : : virtual ~FontSizeBox();
541 : :
542 : : void Reformat();
543 : : void Modify();
544 : :
545 : : void Fill( const FontInfo* pInfo, const FontList* pList );
546 : :
547 : : void EnableRelativeMode( sal_uInt16 nMin = 50, sal_uInt16 nMax = 150,
548 : : sal_uInt16 nStep = 5 );
549 : : void EnablePtRelativeMode( short nMin = -200, short nMax = 200,
550 : : short nStep = 10 );
551 : 0 : sal_Bool IsRelativeMode() const { return bRelativeMode; }
552 : : void SetRelative( sal_Bool bRelative = sal_False );
553 : 0 : sal_Bool IsRelative() const { return bRelative; }
554 : 0 : void SetPtRelative( sal_Bool bPtRel = sal_True )
555 : 0 : { bPtRelative = bPtRel; SetRelative( sal_True ); }
556 : 0 : sal_Bool IsPtRelative() const { return bPtRelative; }
557 : :
558 : : virtual void SetValue( sal_Int64 nNewValue, FieldUnit eInUnit );
559 : : virtual void SetValue( sal_Int64 nNewValue );
560 : : virtual sal_Int64 GetValue( FieldUnit eOutUnit ) const;
561 : : virtual sal_Int64 GetValue() const;
562 : :
563 : : private:
564 : : // declared as private because some compilers would generate the default functions
565 : : FontSizeBox( const FontSizeBox& );
566 : : FontSizeBox& operator =( const FontSizeBox& );
567 : : };
568 : :
569 : : #endif // _CTRLBOX_HXX
570 : :
571 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|