Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef INCLUDED_CUI_SOURCE_DIALOGS_COMMONLINGUI_HXX
21 : #define INCLUDED_CUI_SOURCE_DIALOGS_COMMONLINGUI_HXX
22 :
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>
29 :
30 :
31 : // SvxClickInfoCtr
32 :
33 :
34 : class SvxClickInfoCtr: public Control
35 : {
36 : private:
37 : FixedInfo aFixedInfo;
38 : Link aActivateLink;
39 :
40 : public:
41 : SvxClickInfoCtr( Window* pParent, const ResId& rResId );
42 : virtual ~SvxClickInfoCtr();
43 :
44 : virtual void SetText( const OUString& rStr ) SAL_OVERRIDE;
45 : virtual OUString GetText() const SAL_OVERRIDE;
46 :
47 : void SetActivateHdl( const Link& rLink ) { aActivateLink = rLink; }
48 : const Link& GetActivateHdl() const { return aActivateLink; }
49 :
50 : protected:
51 : virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
52 : virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
53 :
54 : };
55 :
56 :
57 : // SvxCommonLinguisticControl
58 :
59 0 : class SvxCommonLinguisticControl : public Window
60 : {
61 : public:
62 : enum ButtonType
63 : {
64 : eClose,
65 : eIgnore,
66 : eIgnoreAll,
67 : eChange,
68 : eChangeAll,
69 : eOptions
70 : };
71 :
72 : protected:
73 : FixedText aWordText;
74 : SvxClickInfoCtr aAktWord;
75 :
76 : FixedText aNewWord;
77 : Edit aNewWordED;
78 :
79 : FixedText aSuggestionFT;
80 :
81 : PushButton aIgnoreBtn;
82 : PushButton aIgnoreAllBtn;
83 : PushButton aChangeBtn;
84 : PushButton aChangeAllBtn;
85 : PushButton aOptionsBtn;
86 :
87 : FixedInfo aStatusText;
88 : HelpButton aHelpBtn;
89 : CancelButton aCancelBtn;
90 :
91 : GroupBox aAuditBox;
92 :
93 : protected:
94 : virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
95 :
96 : private:
97 : PushButton* implGetButton( ButtonType _eType ) const;
98 :
99 : public:
100 : SvxCommonLinguisticControl( ModalDialog* _pParent );
101 :
102 : // handlers
103 : inline void SetResetWordHdl( const Link& _rLink ) { aAktWord.SetActivateHdl( _rLink ); }
104 : inline const Link& GetResetWordHdl() const { return aAktWord.GetActivateHdl(); }
105 :
106 : void SetButtonHandler( ButtonType _eType, const Link& _rHandler );
107 : void EnableButton( ButtonType _eType, sal_Bool _bEnable );
108 :
109 0 : inline PushButton* GetButton( ButtonType _eType ) { return implGetButton( _eType ); }
110 : inline const PushButton* GetButton( ButtonType _eType ) const { return implGetButton( _eType ); }
111 :
112 : /// control groups in this window which cannot be devided (e.g. are adjacent in the Z order)
113 : enum ControlGroup
114 : {
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)
119 : };
120 :
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.
124 : */
125 : void InsertControlGroup( Window& _rFirstGroupWindow, Window& _rLastGroupWindow, ControlGroup _eInsertAfter );
126 :
127 : /** enlarges the window
128 :
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.
132 : */
133 : void Enlarge( sal_Int32 _nX, sal_Int32 _nY );
134 :
135 : // control access methods
136 0 : inline void SetCurrentText( const OUString& _rText ) { aAktWord.SetText( _rText ); }
137 0 : inline OUString GetCurrentText( ) const { return aAktWord.GetText(); }
138 :
139 : inline void SetStatusText( const OUString& _rText ) { aStatusText.SetText( _rText ); }
140 : inline OUString GetStatusText( ) const { return aStatusText.GetText(); }
141 :
142 0 : inline Edit& GetWordInputControl() { return aNewWordED; }
143 : inline const Edit& GetWordInputControl() const { return aNewWordED; }
144 :
145 : /// @return the location (upper-left corner) of the group of action buttons
146 0 : inline Point GetActionButtonsLocation( ) const { return aIgnoreBtn.GetPosPixel(); }
147 : };
148 :
149 :
150 :
151 : #endif // INCLUDED_CUI_SOURCE_DIALOGS_COMMONLINGUI_HXX
152 :
153 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|