/Users/ericb/Desktop/SRC680_m247/starmath/inc/dialog.hxx

Go to the documentation of this file.
00001 /*************************************************************************
00002  *
00003  *  OpenOffice.org - a multi-platform office productivity suite
00004  *
00005  *  $RCSfile: dialog.hxx,v $
00006  *
00007  *  $Revision: 1.20 $
00008  *
00009  *  last change: $Author: rt $ $Date: 2007/11/09 10:52:15 $
00010  *
00011  *  The Contents of this file are made available subject to
00012  *  the terms of GNU Lesser General Public License Version 2.1.
00013  *
00014  *
00015  *    GNU Lesser General Public License Version 2.1
00016  *    =============================================
00017  *    Copyright 2005 by Sun Microsystems, Inc.
00018  *    901 San Antonio Road, Palo Alto, CA 94303, USA
00019  *
00020  *    This library is free software; you can redistribute it and/or
00021  *    modify it under the terms of the GNU Lesser General Public
00022  *    License version 2.1, as published by the Free Software Foundation.
00023  *
00024  *    This library is distributed in the hope that it will be useful,
00025  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
00026  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00027  *    Lesser General Public License for more details.
00028  *
00029  *    You should have received a copy of the GNU Lesser General Public
00030  *    License along with this library; if not, write to the Free Software
00031  *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
00032  *    MA  02111-1307  USA
00033  *
00034  ************************************************************************/
00035 #ifndef DIALOG_HXX
00036 #define DIALOG_HXX
00037 
00038 #include <vcl/image.hxx>
00039 
00040 #ifndef _SV_DIALOG_HXX //autogen
00041 #include <vcl/dialog.hxx>
00042 #endif
00043 #ifndef _SV_FIXED_HXX //autogen
00044 #include <vcl/fixed.hxx>
00045 #endif
00046 #ifndef _SV_BUTTON_HXX //autogen
00047 #include <vcl/button.hxx>
00048 #endif
00049 #ifndef _SV_IMAGE_HXX
00050 #include <vcl/image.hxx>
00051 #endif
00052 #ifndef _SFXTABDLG_HXX //autogen
00053 #include <sfx2/tabdlg.hxx>
00054 #endif
00055 #ifndef _SV_COMBOBOX_HXX //autogen
00056 #include <vcl/combobox.hxx>
00057 #endif
00058 #ifndef _SVX_CHARMAP_HXX
00059 #include <svx/charmap.hxx>
00060 #endif
00061 #ifndef _BASEDLGS_HXX //autogen
00062 #include <sfx2/basedlgs.hxx>
00063 #endif
00064 #ifndef _SV_FIELD_HXX //autogen
00065 #include <vcl/field.hxx>
00066 #endif
00067 #ifndef _SV_MENUBTN_HXX //autogen
00068 #include <vcl/menubtn.hxx>
00069 #endif
00070 #ifndef _SV_SCRBAR_HXX //autogen
00071 #include <vcl/scrbar.hxx>
00072 #endif
00073 #ifndef _SV_CTRL_HXX //autogen
00074 #include <vcl/ctrl.hxx>
00075 #endif
00076 #ifndef _SV_MENU_HXX //autogen
00077 #include <vcl/menu.hxx>
00078 #endif
00079 #ifndef _SV_OUTDEV_HXX //autogen
00080 #include <vcl/outdev.hxx>
00081 #endif
00082 #ifndef _CTRLBOX_HXX //autogen
00083 #include <svtools/ctrlbox.hxx>
00084 #endif
00085 #ifndef _CTRLTOOL_HXX //autogen
00086 #include <svtools/ctrltool.hxx>
00087 #endif
00088 
00089 #ifndef UTILITY_HXX
00090 #include "utility.hxx"
00091 #endif
00092 #ifndef FORMAT_HXX
00093 #include "format.hxx"
00094 #endif
00095 #ifndef SYMBOL_HXX
00096 #include "symbol.hxx"
00097 #endif
00098 
00099 
00100 #define CATEGORY_NONE   0xFFFF
00101 
00102 /**************************************************************************/
00103 
00104 const XubString GetFontStyleName(const Font &rFont);
00105 void                    SetFontStyle(const XubString &rStyleName, Font &rFont);
00106 
00107 /**************************************************************************/
00108 
00109 class SmPrintOptionsTabPage : public SfxTabPage
00110 {
00111     FixedLine       aFixedLine1;
00112         CheckBox                aTitle;
00113         CheckBox                aText;
00114         CheckBox                aFrame;
00115     FixedLine       aFixedLine2;
00116         RadioButton     aSizeNormal;
00117         RadioButton     aSizeScaled;
00118         RadioButton     aSizeZoomed;
00119         MetricField     aZoom;
00120     FixedLine       aFixedLine3;
00121         CheckBox                aNoRightSpaces;
00122 
00123         DECL_LINK(SizeButtonClickHdl, Button *);
00124 
00125         virtual BOOL    FillItemSet(SfxItemSet& rSet);
00126         virtual void    Reset(const SfxItemSet& rSet);
00127 
00128 public:
00129         static SfxTabPage* Create(Window *pWindow, const SfxItemSet &rSet);
00130 
00131         SmPrintOptionsTabPage(Window *pParent, const SfxItemSet &rOptions);
00132 };
00133 
00134 /**************************************************************************/
00135 
00136 class SmShowFont : public Control
00137 {
00138         virtual void    Paint(const Rectangle&);
00139 
00140 public:
00141         SmShowFont(Window *pParent, const ResId& rResId) :
00142                 Control(pParent, rResId)
00143         {
00144         }
00145 
00146         void SetFont(const Font& rFont);
00147 };
00148 
00149 class SmFontDialog : public ModalDialog
00150 {
00151         FixedText               aFixedText1;
00152         ComboBox                aFontBox;
00153         CheckBox                aBoldCheckBox;
00154         CheckBox                aItalicCheckBox;
00155         OKButton                aOKButton1;
00156         CancelButton    aCancelButton1;
00157         SmShowFont              aShowFont;
00158     FixedText       aFixedText2;
00159 
00160         Font    Face;
00161 
00162         DECL_LINK(FontSelectHdl, ComboBox *);
00163         DECL_LINK(FontModifyHdl, ComboBox *);
00164         DECL_LINK(AttrChangeHdl, CheckBox *);
00165 
00166     void            InitColor_Impl();
00167 
00168     virtual void    DataChanged( const DataChangedEvent& rDCEvt );
00169 
00170 public:
00171     SmFontDialog(Window * pParent, OutputDevice *pFntListDevice, BOOL bHideCheckboxes, BOOL bFreeRes = TRUE);
00172 
00173         const Font&     GetFont() const { return Face; }
00174         void            SetFont(const Font &rFont);
00175 };
00176 
00177 /**************************************************************************/
00178 
00179 class SmFontSizeDialog : public ModalDialog
00180 {
00181         FixedText               aFixedText1;
00182         MetricField     aBaseSize;
00183         FixedText               aFixedText4;
00184         MetricField     aTextSize;
00185         FixedText               aFixedText5;
00186         MetricField     aIndexSize;
00187         FixedText               aFixedText6;
00188         MetricField     aFunctionSize;
00189         FixedText               aFixedText7;
00190         MetricField     aOperatorSize;
00191         FixedText               aFixedText8;
00192         MetricField     aBorderSize;
00193     FixedLine       aFixedLine1;
00194         OKButton                aOKButton1;
00195         CancelButton    aCancelButton1;
00196         PushButton              aDefaultButton;
00197 
00198         DECL_LINK(DefaultButtonClickHdl, Button *);
00199 
00200 public:
00201         SmFontSizeDialog(Window *pParent, BOOL bFreeRes = TRUE);
00202 
00203         void ReadFrom(const SmFormat &rFormat);
00204         void WriteTo (SmFormat &rFormat) const;
00205 };
00206 
00207 /**************************************************************************/
00208 
00209 class SmFontTypeDialog : public ModalDialog
00210 {
00211         FixedText                       aFixedText1;
00212         SmFontPickListBox       aVariableFont;
00213         FixedText                       aFixedText2;
00214         SmFontPickListBox       aFunctionFont;
00215         FixedText                       aFixedText3;
00216         SmFontPickListBox       aNumberFont;
00217         FixedText                       aFixedText4;
00218         SmFontPickListBox       aTextFont;
00219         FixedText                       aFixedText5;
00220         SmFontPickListBox       aSerifFont;
00221         FixedText                       aFixedText6;
00222         SmFontPickListBox       aSansFont;
00223         FixedText                       aFixedText7;
00224         SmFontPickListBox       aFixedFont;
00225     FixedLine           aFixedLine1;
00226     FixedLine           aFixedLine2;
00227         OKButton                        aOKButton1;
00228         CancelButton            aCancelButton1;
00229         MenuButton                      aMenuButton;
00230         PushButton                      aDefaultButton;
00231 
00232     OutputDevice       *pFontListDev;
00233 
00234         DECL_LINK(MenuSelectHdl, Menu *);
00235         DECL_LINK(DefaultButtonClickHdl, Button *);
00236 
00237 public:
00238     SmFontTypeDialog(Window *pParent, OutputDevice *pFntListDevice, BOOL bFreeRes = TRUE);
00239 
00240         void ReadFrom(const SmFormat &rFormat);
00241         void WriteTo (SmFormat &rFormat) const;
00242 };
00243 
00244 /**************************************************************************/
00245 
00246 #define NOCATEGORIES    10
00247 
00248 class SmCategoryDesc : public Resource
00249 {
00250     XubString       Name;
00251         XubString          *Strings[4];
00252     Bitmap         *Graphics[4];    /* regular bitmaps */
00253     Bitmap         *GraphicsH[4];   /* high contrast bitmaps */
00254     USHORT          Minimum[4];
00255     USHORT          Maximum[4];
00256     USHORT          Value[4];
00257     BOOL            bIsHighContrast;
00258 
00259 public:
00260         SmCategoryDesc(const ResId &rResId, USHORT nCategoryIdx);
00261         ~SmCategoryDesc();
00262 
00263         const XubString &       GetName() const                                 { return Name; }
00264         const XubString *       GetString(USHORT Index) const   { return Strings[Index];  }
00265         USHORT                  GetMinimum(USHORT Index)                { return Minimum[Index]; }
00266         USHORT                  GetMaximum(USHORT Index)                { return Maximum[Index]; }
00267         USHORT                  GetValue(USHORT Index) const    { return Value[Index]; }
00268         void                    SetValue(USHORT Index, USHORT nVal) { Value[Index] = nVal;}
00269 
00270     void            SetHighContrast( BOOL bVal )    { bIsHighContrast = bVal; }
00271     const Bitmap *  GetGraphic(USHORT Index) const
00272     {
00273         return bIsHighContrast ? GraphicsH[Index] : Graphics[Index];
00274     }
00275 };
00276 
00277 
00278 class SmDistanceDialog : public ModalDialog
00279 {
00280         FixedText               aFixedText1;
00281         MetricField     aMetricField1;
00282         FixedText               aFixedText2;
00283         MetricField     aMetricField2;
00284         FixedText               aFixedText3;
00285         MetricField     aMetricField3;
00286         CheckBox                aCheckBox1;
00287         FixedText               aFixedText4;
00288         MetricField     aMetricField4;
00289         OKButton                aOKButton1;
00290         CancelButton    aCancelButton1;
00291         MenuButton              aMenuButton;
00292         PushButton              aDefaultButton;
00293         FixedBitmap     aBitmap;
00294     FixedLine       aFixedLine;
00295 
00296         SmCategoryDesc *Categories[NOCATEGORIES];
00297         USHORT                  nActiveCategory;
00298         BOOL                    bScaleAllBrackets;
00299 
00300         DECL_LINK(GetFocusHdl, Control *);
00301         DECL_LINK(MenuSelectHdl, Menu *);
00302         DECL_LINK(DefaultButtonClickHdl, Button *);
00303         DECL_LINK(CheckBoxClickHdl, CheckBox *);
00304 
00305     using   Window::SetHelpId;
00306         void    SetHelpId(MetricField &rField, ULONG nHelpId);
00307         void    SetCategory(USHORT Category);
00308 
00309     void    ApplyImages();
00310 
00311 public:
00312         SmDistanceDialog(Window *pParent, BOOL bFreeRes = TRUE);
00313         ~SmDistanceDialog();
00314 
00315         void ReadFrom(const SmFormat &rFormat);
00316         void WriteTo (SmFormat &rFormat) /*const*/;
00317 
00318     // Window
00319     virtual void    DataChanged( const DataChangedEvent &rEvt );
00320 };
00321 
00322 
00323 /**************************************************************************/
00324 
00325 
00326 class SmAlignDialog : public ModalDialog
00327 {
00328         RadioButton  aLeft;
00329         RadioButton  aCenter;
00330         RadioButton  aRight;
00331     FixedLine    aFixedLine1;
00332         OKButton         aOKButton1;
00333         CancelButton aCancelButton1;
00334         PushButton       aDefaultButton;
00335 
00336         DECL_LINK(DefaultButtonClickHdl, Button *);
00337 
00338 public:
00339         SmAlignDialog(Window *pParent, BOOL bFreeRes = TRUE);
00340 
00341         void ReadFrom(const SmFormat &rFormat);
00342         void WriteTo (SmFormat &rFormat) const;
00343 };
00344 
00345 /**************************************************************************/
00346 
00347 class SmShowSymbolSet : public Control
00348 {
00349         SmSymSet        aSymbolSet;
00350         ScrollBar       aVScrollBar;
00351         Size            aOutputSize;
00352         Link            aSelectHdlLink;
00353         Link            aDblClickHdlLink;
00354         USHORT          nLen;
00355         USHORT          nRows, nColumns;
00356         USHORT          nSelectSymbol;
00357 
00358         virtual void    Paint(const Rectangle&);
00359         virtual void    MouseButtonDown(const MouseEvent& rMEvt);
00360         virtual void    KeyInput(const KeyEvent& rKEvt);
00361 
00362         DECL_LINK( ScrollHdl, ScrollBar* );
00363 
00364 public:
00365         SmShowSymbolSet(Window *pParent, const ResId& rResId);
00366 
00367         void    SetSymbolSet(const SmSymSet& rSymbolSet);
00368 
00369         void    SelectSymbol(USHORT nSymbol);
00370         USHORT  GetSelectSymbol() const { return nSelectSymbol; }
00371 
00372         void SetSelectHdl(const Link& rLink)   { aSelectHdlLink = rLink; }
00373         void SetDblClickHdl(const Link& rLink) { aDblClickHdlLink = rLink; }
00374 };
00375 
00377 
00378 class SmShowSymbol : public Control
00379 {
00380         Link  aDblClickHdlLink;
00381 
00382         virtual void    Paint(const Rectangle&);
00383         virtual void    MouseButtonDown(const MouseEvent& rMEvt);
00384 
00385 public:
00386         SmShowSymbol(Window *pParent, const ResId& rResId) :
00387                 Control(pParent, rResId) {}
00388 
00389         void    SetSymbol(const SmSym *pSymbol);
00390         void    SetDblClickHdl(const Link &rLink) { aDblClickHdlLink = rLink; }
00391 };
00392 
00394 
00395 class SmSymDefineDialog;
00396 
00397 class SmSymbolDialog : public ModalDialog
00398 {
00399         FixedText               aSymbolSetText;
00400         ListBox                 aSymbolSets;
00401         SmShowSymbolSet aSymbolSetDisplay;
00402         FixedText               aSymbolName;
00403         SmShowSymbol    aSymbolDisplay;
00404         PushButton              aGetBtn;
00405         PushButton              aCloseBtn;
00406         PushButton              aEditBtn;
00407 
00408     SmViewShell        &rViewSh;
00409         SmSymSetManager    &rSymSetMgr;
00410         const SmSymSet     *pSymSet;
00411     
00412     OutputDevice       *pFontListDev;
00413 
00414         DECL_LINK(SymbolSetChangeHdl, ListBox *);
00415         DECL_LINK(SymbolChangeHdl, SmShowSymbolSet *);
00416         DECL_LINK(SymbolDblClickHdl, SmShowSymbolSet *);
00417         DECL_LINK(CloseClickHdl, Button *);
00418         DECL_LINK(EditClickHdl, Button *);
00419         DECL_LINK(GetClickHdl, Button *);
00420 
00421         void                    FillSymbolSets(BOOL bDeleteText = TRUE);
00422         void                    SetSymbolSetManager(SmSymSetManager &rMgr);
00423         const SmSym    *GetSymbol() const;
00424     void            InitColor_Impl();
00425 
00426     virtual void    DataChanged( const DataChangedEvent& rDCEvt );
00427 
00428 public:
00429     SmSymbolDialog(Window * pParent, OutputDevice *pFntListDevice, 
00430             SmSymSetManager &rSymSetMgr, SmViewShell &rViewShell, BOOL bFreeRes = TRUE);
00431     virtual ~SmSymbolDialog();
00432 
00433         BOOL    SelectSymbolSet(const XubString &rSymbolSetName);
00434     void    SelectSymbol(USHORT nSymbolPos);
00435     USHORT  GetSelectedSymbol() const   { return aSymbolSetDisplay.GetSelectSymbol(); }
00436 };
00437 
00439 
00440 class SmShowChar : public Control
00441 {
00442         virtual void    Paint(const Rectangle&);
00443 
00444 public:
00445         SmShowChar(Window *pParent, const ResId& rResId)
00446         : Control(pParent, rResId)
00447         {
00448         }
00449 
00450         void    SetChar(xub_Unicode aChar);
00451         void    SetFont(const Font &rFont);
00452 };
00453 
00455 
00456 class SmSymDefineDialog : public ModalDialog
00457 {
00458     FixedText       aOldSymbolText;
00459     ComboBox        aOldSymbols;
00460     FixedText       aOldSymbolSetText;
00461     ComboBox        aOldSymbolSets;
00462     SvxShowCharSet  aCharsetDisplay;
00463     FixedText       aSymbolText;
00464     ComboBox        aSymbols;
00465     FixedText       aSymbolSetText;
00466     ComboBox        aSymbolSets;
00467     FixedText       aFontText;
00468     ListBox         aFonts;
00469     FixedText       aFontsSubsetFT;
00470     ListBox         aFontsSubsetLB;
00471     FixedText       aStyleText;
00472     FontStyleBox    aStyles;
00473     FixedText       aOldSymbolName;
00474     SmShowChar      aOldSymbolDisplay;
00475     FixedText       aOldSymbolSetName;
00476     FixedText       aSymbolName;
00477     SmShowChar      aSymbolDisplay;
00478     FixedText       aSymbolSetName;
00479     OKButton        aOkBtn;
00480     CancelButton    aCancelBtn;
00481     PushButton      aAddBtn;
00482     PushButton      aChangeBtn;
00483     PushButton      aDeleteBtn;
00484     FixedImage      aRightArrow;
00485     Image           aRigthArrow_Im;
00486     Image           aRigthArrow_Im_HC;     // hi-contrast version
00487 
00488         SmSymSetManager         aSymSetMgrCopy,
00489                                            &rSymSetMgr;
00490         const SmSym                *pOrigSymbol;
00491 
00492     const SubsetMap    *pSubsetMap;
00493     FontList           *pFontList;
00494 
00495         DECL_LINK(OldSymbolChangeHdl, ComboBox *);
00496         DECL_LINK(OldSymbolSetChangeHdl, ComboBox *);
00497         DECL_LINK(ModifyHdl, ComboBox *);
00498         DECL_LINK(FontChangeHdl, ListBox *);
00499     DECL_LINK(SubsetChangeHdl, ListBox*);
00500         DECL_LINK(StyleChangeHdl, ComboBox *);
00501     DECL_LINK(CharHighlightHdl, Control* pControl);
00502         DECL_LINK(AddClickHdl, Button *);
00503         DECL_LINK(ChangeClickHdl, Button *);
00504         DECL_LINK(DeleteClickHdl, Button *);
00505 
00506         void    FillSymbols(ComboBox &rComboBox, BOOL bDeleteText = TRUE);
00507         void    FillSymbolSets(ComboBox &rComboBox, BOOL bDeleteText = TRUE);
00508         void    FillFonts(BOOL bDeleteText = TRUE);
00509         void    FillStyles(BOOL bDeleteText = TRUE);
00510 
00511         void    SetSymbolSetManager(const SmSymSetManager &rMgr);
00512         void    SetFont(const XubString &rFontName, const XubString &rStyleName);
00513         void    SetOrigSymbol(const SmSym *pSymbol, const XubString &rSymbolSetName);
00514         void    UpdateButtons();
00515 
00516         BOOL    SelectSymbolSet(ComboBox &rComboBox, const XubString &rSymbolSetName,
00517                                                         BOOL bDeleteText);
00518         BOOL    SelectSymbol(ComboBox &rComboBox, const XubString &rSymbolName,
00519                                                         BOOL bDeleteText);
00520         BOOL    SelectFont(const XubString &rFontName, BOOL bApplyFont);
00521         BOOL    SelectStyle(const XubString &rStyleName, BOOL bApplyFont);
00522 
00523 
00524     SmSymSet              *GetSymbolSet(const ComboBox &rComboBox);
00525         inline const SmSymSet *GetSymbolSet(const ComboBox &rComboBox) const;
00526     SmSym                 *GetSymbol(const ComboBox &rComboBox);
00527         inline const SmSym    *GetSymbol(const ComboBox &rComboBox) const;
00528 
00529     void            InitColor_Impl();
00530 
00531     virtual void    DataChanged( const DataChangedEvent& rDCEvt );
00532 
00533 public:
00534     SmSymDefineDialog(Window *pParent, OutputDevice *pFntListDevice, SmSymSetManager &rMgr, BOOL bFreeRes = TRUE);
00535         ~SmSymDefineDialog();
00536 
00537     using OutputDevice::SetFont;
00538 
00539         // Dialog
00540         virtual short   Execute();
00541 
00542         inline BOOL     SelectOldSymbolSet(const XubString &rSymbolSetName);
00543         inline BOOL     SelectOldSymbol(const XubString &rSymbolName);
00544         inline BOOL     SelectSymbolSet(const XubString &rSymbolSetName);
00545         inline BOOL     SelectSymbol(const XubString &rSymbolName);
00546         BOOL            SelectFont(const XubString &rFontName)   { return SelectFont(rFontName, TRUE); }
00547         BOOL            SelectStyle(const XubString &rStyleName) { return SelectStyle(rStyleName, TRUE); };
00548         void            SelectChar(xub_Unicode cChar);
00549 };
00550 
00551 inline const SmSymSet * SmSymDefineDialog::GetSymbolSet(const ComboBox &rComboBox) const
00552 {
00553         return ((SmSymDefineDialog *) this)->GetSymbolSet(rComboBox);
00554 }
00555 
00556 inline const SmSym * SmSymDefineDialog::GetSymbol(const ComboBox &rComboBox) const
00557 {
00558         return ((SmSymDefineDialog *) this)->GetSymbol(rComboBox);
00559 }
00560 
00561 inline BOOL     SmSymDefineDialog::SelectOldSymbolSet(const XubString &rSymbolSetName)
00562 {
00563         return SelectSymbolSet(aOldSymbolSets, rSymbolSetName, FALSE);
00564 }
00565 
00566 inline BOOL     SmSymDefineDialog::SelectOldSymbol(const XubString &rSymbolName)
00567 {
00568         return SelectSymbol(aOldSymbols, rSymbolName, FALSE);
00569 }
00570 
00571 inline BOOL     SmSymDefineDialog::SelectSymbolSet(const XubString &rSymbolSetName)
00572 {
00573         return SelectSymbolSet(aSymbolSets, rSymbolSetName, FALSE);
00574 }
00575 
00576 inline BOOL     SmSymDefineDialog::SelectSymbol(const XubString &rSymbolName)
00577 {
00578         return SelectSymbol(aSymbols, rSymbolName, FALSE);
00579 }
00580 
00581 
00582 #endif
00583 

Generated on Wed Feb 20 17:21:56 2008 for maths by  doxygen 1.5.1