update credits
[LibreOffice.git] / cui / source / dialogs / commonlingui.hxx
blob90c3f4ec8644203178b9abc7f4eeb4fbaba71e3b
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef SVX_COMMON_LINGUI_HXX
21 #define SVX_COMMON_LINGUI_HXX
23 #include <vcl/ctrl.hxx>
24 #include <svtools/stdctrl.hxx>
25 #include <vcl/edit.hxx>
26 #include <vcl/button.hxx>
27 #include <vcl/group.hxx>
28 #include <vcl/dialog.hxx>
30 //=============================================================================
31 // SvxClickInfoCtr
32 //=============================================================================
34 class SvxClickInfoCtr: public Control
36 private:
37 FixedInfo aFixedInfo;
38 Link aActivateLink;
40 public:
41 SvxClickInfoCtr( Window* pParent, const ResId& rResId );
42 ~SvxClickInfoCtr();
44 virtual void SetText( const OUString& rStr );
45 virtual OUString GetText() const;
47 void SetActivateHdl( const Link& rLink ) { aActivateLink = rLink; }
48 const Link& GetActivateHdl() const { return aActivateLink; }
50 protected:
51 virtual void MouseButtonDown( const MouseEvent& rMEvt );
52 virtual long PreNotify( NotifyEvent& rNEvt );
56 //=============================================================================
57 // SvxCommonLinguisticControl
58 //=============================================================================
59 class SvxCommonLinguisticControl : public Window
61 public:
62 enum ButtonType
64 eClose,
65 eIgnore,
66 eIgnoreAll,
67 eChange,
68 eChangeAll,
69 eOptions
72 protected:
73 FixedText aWordText;
74 SvxClickInfoCtr aAktWord;
76 FixedText aNewWord;
77 Edit aNewWordED;
79 FixedText aSuggestionFT;
81 PushButton aIgnoreBtn;
82 PushButton aIgnoreAllBtn;
83 PushButton aChangeBtn;
84 PushButton aChangeAllBtn;
85 PushButton aOptionsBtn;
87 FixedInfo aStatusText;
88 HelpButton aHelpBtn;
89 CancelButton aCancelBtn;
91 GroupBox aAuditBox;
93 protected:
94 virtual void Paint( const Rectangle& rRect );
96 private:
97 PushButton* implGetButton( ButtonType _eType ) const;
99 public:
100 SvxCommonLinguisticControl( ModalDialog* _pParent );
102 // handlers
103 inline void SetResetWordHdl( const Link& _rLink ) { aAktWord.SetActivateHdl( _rLink ); }
104 inline const Link& GetResetWordHdl() const { return aAktWord.GetActivateHdl(); }
106 void SetButtonHandler( ButtonType _eType, const Link& _rHandler );
107 void EnableButton( ButtonType _eType, sal_Bool _bEnable );
109 inline PushButton* GetButton( ButtonType _eType ) { return implGetButton( _eType ); }
110 inline const PushButton* GetButton( ButtonType _eType ) const { return implGetButton( _eType ); }
112 /// control groups in this window which cannot be devided (e.g. are adjacent in the Z order)
113 enum ControlGroup
115 eLeftRightWords, ///< the controls for the two words (original and suggestion), including the labels
116 eSuggestionLabel, ///< the label for the suggestion
117 eActionButtons, ///< the group of "ignore(all)" / "change(all)" buttons
118 eDialogButtons ///< the group of dialog control buttons (help and close)
121 /** Users of this class may want to insert own controls in some places,
122 where the ordinary Z-Order determined by construction time is not
123 sufficient. Use the following methods for this.
125 void InsertControlGroup( Window& _rFirstGroupWindow, Window& _rLastGroupWindow, ControlGroup _eInsertAfter );
127 /** enlarges the window
129 Some controls "stick" to the borders: The group of change/ignore buttons, for instance, sticks
130 to the right, the dictionary list as well as the close/help buttons stick to the bottom of the
131 window.
133 void Enlarge( sal_Int32 _nX, sal_Int32 _nY );
135 // control access methods
136 inline void SetCurrentText( const String& _rText ) { aAktWord.SetText( _rText ); }
137 inline String GetCurrentText( ) const { return aAktWord.GetText(); }
139 inline void SetStatusText( const String& _rText ) { aStatusText.SetText( _rText ); }
140 inline String GetStatusText( ) const { return aStatusText.GetText(); }
142 inline Edit& GetWordInputControl() { return aNewWordED; }
143 inline const Edit& GetWordInputControl() const { return aNewWordED; }
145 /// @return the location (upper-left corner) of the group of action buttons
146 inline Point GetActionButtonsLocation( ) const { return aIgnoreBtn.GetPosPixel(); }
151 #endif // SVX_COMMON_LINGUI_HXX
153 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */