xref: /AOO41X/main/sc/source/ui/inc/funcutl.hxx (revision 38d50f7b14e1cf975d8c6468d9633894cd59b523)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef SC_FUNCUTL_HXX
25 #define SC_FUNCUTL_HXX
26 
27 #ifndef _SCRBAR_HXX //autogen
28 #include <vcl/scrbar.hxx>
29 #endif
30 #ifndef _FIXED_HXX //autogen
31 #include <vcl/fixed.hxx>
32 #endif
33 #include <svtools/svmedit.hxx>
34 #include "anyrefdg.hxx"     // formula::RefButton
35 
36 
37 //============================================================================
38 // class ValWnd
39 
40 class ValWnd : public Window
41 {
42 public:
43             ValWnd( Window* pParent, const ResId& rId );
44 
45     void    SetValue( const String& rStrVal );
46 
47 protected:
48     virtual void    Paint( const Rectangle& rRect );
49 
50 private:
51     String      aStrValue;
52     Rectangle   aRectOut;
53 };
54 
55 
56 //============================================================================
57 // class ScEditBox
58 
59 class ScEditBox : public Control
60 {
61 private:
62 
63     MultiLineEdit*  pMEdit;
64     Link            aSelChangedLink;
65     Selection       aOldSel;
66     sal_Bool            bMouseFlag;
67                     DECL_LINK( ChangedHdl, ScEditBox* );
68 
69 protected:
70 
71     virtual long    PreNotify( NotifyEvent& rNEvt );
72     virtual void    SelectionChanged();
73     virtual void    Resize();
74     virtual void    GetFocus();
75 
76 
77 public:
78                     ScEditBox( Window* pParent, const ResId& rResId );
79 
80                     ~ScEditBox();
81 
GetEdit()82     MultiLineEdit*  GetEdit() {return pMEdit;}
83 
SetSelChangedHdl(const Link & rLink)84     void            SetSelChangedHdl( const Link& rLink ) { aSelChangedLink = rLink; }
GetSelChangedHdl() const85     const Link&     GetSelChangedHdl() const { return aSelChangedLink; }
86 
87     void            UpdateOldSel();
88 };
89 
90 
91 
92 //============================================================================
93 // class ArgEdit
94 
95 class ArgEdit : public formula::RefEdit
96 {
97 public:
98             ArgEdit( Window* pParent, const ResId& rResId );
99 
100     void    Init( ArgEdit* pPrevEdit, ArgEdit* pNextEdit,
101                   ScrollBar& rArgSlider, sal_uInt16 nArgCount );
102 
103 protected:
104     virtual void    KeyInput( const KeyEvent& rKEvt );
105 
106 private:
107     ArgEdit*    pEdPrev;
108     ArgEdit*    pEdNext;
109     ScrollBar*  pSlider;
110     sal_uInt16      nArgs;
111 };
112 
113 
114 //============================================================================
115 // class ArgInput
116 
117 class ArgInput
118 {
119 private:
120 
121     Link            aFxClickLink;
122     Link            aRefClickLink;
123     Link            aFxFocusLink;
124     Link            aRefFocusLink;
125     Link            aEdFocusLink;
126     Link            aEdModifyLink;
127 
128     FixedText*      pFtArg;
129     ImageButton*    pBtnFx;
130     ArgEdit*        pEdArg;
131     formula::RefButton* pRefBtn;
132 
133     DECL_LINK(  FxBtnClickHdl, ImageButton* );
134     DECL_LINK(  RefBtnClickHdl,formula::RefButton* );
135     DECL_LINK(  FxBtnFocusHdl, ImageButton* );
136     DECL_LINK(  RefBtnFocusHdl,formula::RefButton* );
137     DECL_LINK(  EdFocusHdl, ArgEdit* );
138     DECL_LINK(  EdModifyHdl,ArgEdit* );
139 
140 protected:
141 
142     virtual void    FxClick();
143     virtual void    RefClick();
144     virtual void    FxFocus();
145     virtual void    RefFocus();
146     virtual void    EdFocus();
147     virtual void    EdModify();
148 
149 public:
150 
151     ArgInput();
152 
153     void        InitArgInput (  FixedText*      pftArg,
154                                 ImageButton*    pbtnFx,
155                                 ArgEdit*        pedArg,
156                                 formula::RefButton* prefBtn);
157 
158     void        SetArgName(const String &aArg);
159     String      GetArgName();
160     void        SetArgNameFont(const Font&);
161 
162     void        SetArgVal(const String &aVal);
163     String      GetArgVal();
164 
165     void        SetArgSelection (const Selection& rSel );
166 
GetArgEdPtr()167     ArgEdit*    GetArgEdPtr() {return pEdArg;}
168 
169 
SetFxClickHdl(const Link & rLink)170     void            SetFxClickHdl( const Link& rLink ) { aFxClickLink = rLink; }
GetFxClickHdl() const171     const Link&     GetFxClickHdl() const { return aFxClickLink; }
172 
SetRefClickHdl(const Link & rLink)173     void            SetRefClickHdl( const Link& rLink ) { aRefClickLink = rLink; }
GetRefClickHdl() const174     const Link&     GetRefClickHdl() const { return aRefClickLink; }
175 
SetFxFocusHdl(const Link & rLink)176     void            SetFxFocusHdl( const Link& rLink ) { aFxFocusLink = rLink; }
GetFxFocusHdl() const177     const Link&     GetFxFocusHdl() const { return aFxFocusLink; }
178 
SetRefFocusHdl(const Link & rLink)179     void            SetRefFocusHdl( const Link& rLink ) { aRefFocusLink = rLink; }
GetRefFocusHdl() const180     const Link&     GetRefFocusHdl() const { return aRefFocusLink; }
181 
SetEdFocusHdl(const Link & rLink)182     void            SetEdFocusHdl( const Link& rLink ) { aEdFocusLink = rLink; }
GetEdFocusHdl() const183     const Link&     GetEdFocusHdl() const { return aEdFocusLink; }
184 
SetEdModifyHdl(const Link & rLink)185     void            SetEdModifyHdl( const Link& rLink ) { aEdModifyLink = rLink; }
GetEdModifyHdl() const186     const Link&     GetEdModifyHdl() const { return aEdModifyLink; }
187 
188     void Hide();
189     void Show();
190 
191 };
192 
193 
194 #endif
195