update dev300-m58
[ooovba.git] / svx / source / cui / commonlingui.hxx
bloba6b8142789b531eb5ee784ae7903a7f2832bd9b3
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: commonlingui.hxx,v $
10 * $Revision: 1.7 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef SVX_COMMON_LINGUI_HXX
32 #define SVX_COMMON_LINGUI_HXX
34 #include <vcl/ctrl.hxx>
35 #include <svtools/stdctrl.hxx>
36 #include <vcl/edit.hxx>
37 #include <svx/svxbox.hxx>
38 #ifndef _SV_BUTTON_HXX
39 #include <vcl/button.hxx>
40 #endif
41 #include <vcl/group.hxx>
42 #include <vcl/dialog.hxx>
44 //=============================================================================
45 // SvxClickInfoCtr
46 //=============================================================================
48 class SvxClickInfoCtr: public Control
50 private:
51 FixedInfo aFixedInfo;
52 Link aActivateLink;
54 public:
55 SvxClickInfoCtr( Window* pParent, const ResId& rResId );
56 ~SvxClickInfoCtr();
58 virtual void SetText( const XubString& rStr );
59 virtual XubString GetText() const;
61 void SetActivateHdl( const Link& rLink ) { aActivateLink = rLink; }
62 const Link& GetActivateHdl() const { return aActivateLink; }
64 protected:
65 virtual void MouseButtonDown( const MouseEvent& rMEvt );
66 virtual long PreNotify( NotifyEvent& rNEvt );
70 //=============================================================================
71 // SvxCommonLinguisticControl
72 //=============================================================================
73 class SvxCommonLinguisticControl : public Window
75 public:
76 enum ButtonType
78 eClose,
79 eIgnore,
80 eIgnoreAll,
81 eChange,
82 eChangeAll,
83 eOptions
86 protected:
87 FixedText aWordText;
88 SvxClickInfoCtr aAktWord;
90 FixedText aNewWord;
91 Edit aNewWordED;
93 FixedText aSuggestionFT;
95 PushButton aIgnoreBtn;
96 PushButton aIgnoreAllBtn;
97 PushButton aChangeBtn;
98 PushButton aChangeAllBtn;
99 PushButton aOptionsBtn;
101 FixedInfo aStatusText;
102 HelpButton aHelpBtn;
103 CancelButton aCancelBtn;
105 GroupBox aAuditBox;
107 protected:
108 virtual void Paint( const Rectangle& rRect );
110 private:
111 PushButton* implGetButton( ButtonType _eType ) const;
113 public:
114 SvxCommonLinguisticControl( ModalDialog* _pParent );
116 // handlers
117 inline void SetResetWordHdl( const Link& _rLink ) { aAktWord.SetActivateHdl( _rLink ); }
118 inline const Link& GetResetWordHdl() const { return aAktWord.GetActivateHdl(); }
120 void SetButtonHandler( ButtonType _eType, const Link& _rHandler );
121 void EnableButton( ButtonType _eType, sal_Bool _bEnable );
123 inline PushButton* GetButton( ButtonType _eType ) { return implGetButton( _eType ); }
124 inline const PushButton* GetButton( ButtonType _eType ) const { return implGetButton( _eType ); }
126 // users of this class may want to insert own controls in some places, where the ordinary
127 // Z-Order determined by construction time is not sufficient
128 // Use the following methods for this
129 enum ControlGroup // control groups in this window which cannot be devided (e.g. are adjacent in the Z order)
131 eLeftRightWords, // the controls for the two words (original and suggestion), including the labels
132 eSuggestionLabel, // the label for the suggestion
133 eActionButtons, // the group of "ignore(all)" / "change(all)" buttons
134 eDialogButtons // the group of dialog control buttons (help and close)
136 void InsertControlGroup( Window& _rFirstGroupWindow, Window& _rLastGroupWindow, ControlGroup _eInsertAfter );
138 /** enlarges the window
140 Some controls "stick" to the borders: The group of change/ignore buttons, for instance, sticks
141 to the right, the dictionary list as well as the close/help buttons stick to the bottom of the
142 window.
144 void Enlarge( sal_Int32 _nX, sal_Int32 _nY );
146 // control access methods
147 inline void SetCurrentText( const String& _rText ) { aAktWord.SetText( _rText ); }
148 inline String GetCurrentText( ) const { return aAktWord.GetText(); }
150 inline void SetStatusText( const String& _rText ) { aStatusText.SetText( _rText ); }
151 inline String GetStatusText( ) const { return aStatusText.GetText(); }
153 inline Edit& GetWordInputControl() { return aNewWordED; }
154 inline const Edit& GetWordInputControl() const { return aNewWordED; }
156 // returns the location (upper-left corner) of the group of action buttons
157 inline Point GetActionButtonsLocation( ) const { return aIgnoreBtn.GetPosPixel(); }
159 // updates the help texts for the "change" and "change all" buttons according to the currently
160 // entered texts
161 void UpdateChangesHelp( const String& _rNewText );
162 inline void UpdateChangesHelp( ) { UpdateChangesHelp( GetWordInputControl().GetText() ); }
164 // updates the help texts for the "ignore" and "always ignore" buttons according to the currently
165 // entered texts
166 void UpdateIgnoreHelp( );
168 String GetNewEditWord();
169 void SetNewEditWord( const String& _rNew );
174 #endif // SVX_COMMON_LINGUI_HXX