1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: commonlingui.hxx,v $
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>
41 #include <vcl/group.hxx>
42 #include <vcl/dialog.hxx>
44 //=============================================================================
46 //=============================================================================
48 class SvxClickInfoCtr
: public Control
55 SvxClickInfoCtr( Window
* pParent
, const ResId
& rResId
);
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
; }
65 virtual void MouseButtonDown( const MouseEvent
& rMEvt
);
66 virtual long PreNotify( NotifyEvent
& rNEvt
);
70 //=============================================================================
71 // SvxCommonLinguisticControl
72 //=============================================================================
73 class SvxCommonLinguisticControl
: public Window
88 SvxClickInfoCtr aAktWord
;
93 FixedText aSuggestionFT
;
95 PushButton aIgnoreBtn
;
96 PushButton aIgnoreAllBtn
;
97 PushButton aChangeBtn
;
98 PushButton aChangeAllBtn
;
99 PushButton aOptionsBtn
;
101 FixedInfo aStatusText
;
103 CancelButton aCancelBtn
;
108 virtual void Paint( const Rectangle
& rRect
);
111 PushButton
* implGetButton( ButtonType _eType
) const;
114 SvxCommonLinguisticControl( ModalDialog
* _pParent
);
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
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
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
166 void UpdateIgnoreHelp( );
168 String
GetNewEditWord();
169 void SetNewEditWord( const String
& _rNew
);
174 #endif // SVX_COMMON_LINGUI_HXX