xref: /trunk/main/cui/source/dialogs/commonlingui.hxx (revision 914d351e5f5b84e4342a86d6ab8d4aca7308b9bd)
1c4eee24dSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3c4eee24dSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4c4eee24dSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5c4eee24dSAndrew Rist  * distributed with this work for additional information
6c4eee24dSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7c4eee24dSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8c4eee24dSAndrew Rist  * "License"); you may not use this file except in compliance
9c4eee24dSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11c4eee24dSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13c4eee24dSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14c4eee24dSAndrew Rist  * software distributed under the License is distributed on an
15c4eee24dSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16c4eee24dSAndrew Rist  * KIND, either express or implied.  See the License for the
17c4eee24dSAndrew Rist  * specific language governing permissions and limitations
18c4eee24dSAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20c4eee24dSAndrew Rist  *************************************************************/
21c4eee24dSAndrew Rist 
22c4eee24dSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef SVX_COMMON_LINGUI_HXX
25cdf0e10cSrcweir #define SVX_COMMON_LINGUI_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <vcl/ctrl.hxx>
28cdf0e10cSrcweir #include <svtools/stdctrl.hxx>
29cdf0e10cSrcweir #include <vcl/edit.hxx>
30cdf0e10cSrcweir #include <svtools/svxbox.hxx>
31cdf0e10cSrcweir #ifndef _SV_BUTTON_HXX
32cdf0e10cSrcweir #include <vcl/button.hxx>
33cdf0e10cSrcweir #endif
34cdf0e10cSrcweir #include <vcl/group.hxx>
35cdf0e10cSrcweir #include <vcl/dialog.hxx>
36cdf0e10cSrcweir 
37cdf0e10cSrcweir //=============================================================================
38cdf0e10cSrcweir // SvxClickInfoCtr
39cdf0e10cSrcweir //=============================================================================
40cdf0e10cSrcweir 
41cdf0e10cSrcweir class SvxClickInfoCtr: public Control
42cdf0e10cSrcweir {
43cdf0e10cSrcweir private:
44cdf0e10cSrcweir     FixedInfo                   aFixedInfo;
45cdf0e10cSrcweir     Link                        aActivateLink;
46cdf0e10cSrcweir 
47cdf0e10cSrcweir public:
48cdf0e10cSrcweir     SvxClickInfoCtr( Window* pParent, const ResId& rResId );
49cdf0e10cSrcweir     ~SvxClickInfoCtr();
50cdf0e10cSrcweir 
51cdf0e10cSrcweir     virtual void        SetText( const XubString& rStr );
52cdf0e10cSrcweir     virtual XubString   GetText() const;
53cdf0e10cSrcweir 
SetActivateHdl(const Link & rLink)54cdf0e10cSrcweir     void                SetActivateHdl( const Link& rLink ) { aActivateLink = rLink; }
GetActivateHdl() const55cdf0e10cSrcweir     const Link&         GetActivateHdl() const { return aActivateLink; }
56cdf0e10cSrcweir 
57cdf0e10cSrcweir protected:
58cdf0e10cSrcweir     virtual void        MouseButtonDown( const MouseEvent& rMEvt );
59cdf0e10cSrcweir     virtual long        PreNotify( NotifyEvent& rNEvt );
60cdf0e10cSrcweir 
61cdf0e10cSrcweir };
62cdf0e10cSrcweir 
63cdf0e10cSrcweir //=============================================================================
64cdf0e10cSrcweir // SvxCommonLinguisticControl
65cdf0e10cSrcweir //=============================================================================
66cdf0e10cSrcweir class SvxCommonLinguisticControl : public Window
67cdf0e10cSrcweir {
68cdf0e10cSrcweir public:
69cdf0e10cSrcweir     enum ButtonType
70cdf0e10cSrcweir     {
71cdf0e10cSrcweir         eClose,
72cdf0e10cSrcweir         eIgnore,
73cdf0e10cSrcweir         eIgnoreAll,
74cdf0e10cSrcweir         eChange,
75cdf0e10cSrcweir         eChangeAll,
76cdf0e10cSrcweir         eOptions
77cdf0e10cSrcweir     };
78cdf0e10cSrcweir 
79cdf0e10cSrcweir protected:
80cdf0e10cSrcweir     FixedText       aWordText;
81cdf0e10cSrcweir     SvxClickInfoCtr aAktWord;
82cdf0e10cSrcweir 
83cdf0e10cSrcweir     FixedText       aNewWord;
84cdf0e10cSrcweir     Edit            aNewWordED;
85cdf0e10cSrcweir 
86cdf0e10cSrcweir     FixedText       aSuggestionFT;
87cdf0e10cSrcweir 
88cdf0e10cSrcweir     PushButton      aIgnoreBtn;
89cdf0e10cSrcweir     PushButton      aIgnoreAllBtn;
90cdf0e10cSrcweir     PushButton      aChangeBtn;
91cdf0e10cSrcweir     PushButton      aChangeAllBtn;
92cdf0e10cSrcweir     PushButton      aOptionsBtn;
93cdf0e10cSrcweir 
94cdf0e10cSrcweir     FixedInfo       aStatusText;
95cdf0e10cSrcweir     HelpButton      aHelpBtn;
96cdf0e10cSrcweir     CancelButton    aCancelBtn;
97cdf0e10cSrcweir 
98cdf0e10cSrcweir     GroupBox        aAuditBox;
99cdf0e10cSrcweir 
100cdf0e10cSrcweir protected:
101cdf0e10cSrcweir     virtual void    Paint( const Rectangle& rRect );
102cdf0e10cSrcweir 
103cdf0e10cSrcweir private:
104cdf0e10cSrcweir     PushButton* implGetButton( ButtonType _eType  ) const;
105cdf0e10cSrcweir 
106cdf0e10cSrcweir public:
107cdf0e10cSrcweir     SvxCommonLinguisticControl( ModalDialog* _pParent );
108cdf0e10cSrcweir 
109cdf0e10cSrcweir     // handlers
SetResetWordHdl(const Link & _rLink)110cdf0e10cSrcweir     inline void         SetResetWordHdl( const Link& _rLink )   { aAktWord.SetActivateHdl( _rLink ); }
GetResetWordHdl() const111cdf0e10cSrcweir     inline const Link&  GetResetWordHdl() const                 { return aAktWord.GetActivateHdl(); }
112cdf0e10cSrcweir 
113cdf0e10cSrcweir     void    SetButtonHandler( ButtonType _eType, const Link& _rHandler );
114cdf0e10cSrcweir     void    EnableButton( ButtonType _eType, sal_Bool _bEnable );
115cdf0e10cSrcweir 
GetButton(ButtonType _eType)116cdf0e10cSrcweir     inline  PushButton*         GetButton( ButtonType _eType )          { return implGetButton( _eType  ); }
GetButton(ButtonType _eType) const117cdf0e10cSrcweir     inline  const PushButton*   GetButton( ButtonType _eType ) const    { return implGetButton( _eType  ); }
118cdf0e10cSrcweir 
119cdf0e10cSrcweir     // users of this class may want to insert own controls in some places, where the ordinary
120cdf0e10cSrcweir     // Z-Order determined by construction time is not sufficient
121cdf0e10cSrcweir     // Use the following methods for this
122*07a3d7f1SPedro Giffuni     enum ControlGroup // control groups in this window which cannot be divided (e.g. are adjacent in the Z order)
123cdf0e10cSrcweir     {
124cdf0e10cSrcweir         eLeftRightWords,    // the controls for the two words (original and suggestion), including the labels
125cdf0e10cSrcweir         eSuggestionLabel,   // the label for the suggestion
126cdf0e10cSrcweir         eActionButtons,     // the group of "ignore(all)" / "change(all)" buttons
127cdf0e10cSrcweir         eDialogButtons      // the group of dialog control buttons (help and close)
128cdf0e10cSrcweir     };
129cdf0e10cSrcweir     void    InsertControlGroup( Window& _rFirstGroupWindow, Window& _rLastGroupWindow, ControlGroup _eInsertAfter );
130cdf0e10cSrcweir 
131cdf0e10cSrcweir     /** enlarges the window
132cdf0e10cSrcweir 
133cdf0e10cSrcweir         Some controls "stick" to the borders: The group of change/ignore buttons, for instance, sticks
134cdf0e10cSrcweir         to the right, the dictionary list as well as the close/help buttons stick to the bottom of the
135cdf0e10cSrcweir         window.
136cdf0e10cSrcweir     */
137cdf0e10cSrcweir     void    Enlarge( sal_Int32 _nX, sal_Int32 _nY );
138cdf0e10cSrcweir 
139cdf0e10cSrcweir     // control access methods
SetCurrentText(const String & _rText)140cdf0e10cSrcweir     inline void     SetCurrentText( const String& _rText )  { aAktWord.SetText( _rText ); }
GetCurrentText() const141cdf0e10cSrcweir     inline String   GetCurrentText( ) const                 { return aAktWord.GetText(); }
142cdf0e10cSrcweir 
SetStatusText(const String & _rText)143cdf0e10cSrcweir     inline void     SetStatusText( const String& _rText )   { aStatusText.SetText( _rText ); }
GetStatusText() const144cdf0e10cSrcweir     inline String   GetStatusText( ) const                  { return aStatusText.GetText(); }
145cdf0e10cSrcweir 
GetWordInputControl()146cdf0e10cSrcweir     inline Edit&        GetWordInputControl()           { return aNewWordED; }
GetWordInputControl() const147cdf0e10cSrcweir     inline const Edit&  GetWordInputControl() const { return aNewWordED; }
148cdf0e10cSrcweir 
149cdf0e10cSrcweir     // returns the location (upper-left corner) of the group of action buttons
GetActionButtonsLocation() const150cdf0e10cSrcweir     inline Point    GetActionButtonsLocation( ) const { return aIgnoreBtn.GetPosPixel(); }
151cdf0e10cSrcweir };
152cdf0e10cSrcweir 
153cdf0e10cSrcweir 
154cdf0e10cSrcweir 
155cdf0e10cSrcweir #endif // SVX_COMMON_LINGUI_HXX
156