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 : #ifndef FORMULA_CONTROL_HELPER_HXX_INCLUDED
20 : #define FORMULA_CONTROL_HELPER_HXX_INCLUDED
21 :
22 : #include "formula/funcutl.hxx"
23 : #include <svtools/svmedit.hxx>
24 : namespace formula
25 : {
26 :
27 :
28 : // class ValWnd
29 0 : class ValWnd : public Window
30 : {
31 : public:
32 : ValWnd( Window* pParent, const ResId& rId );
33 :
34 : void SetValue( const OUString& rStrVal );
35 :
36 : protected:
37 : virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
38 :
39 : private:
40 : OUString aStrValue;
41 : Rectangle aRectOut;
42 : };
43 :
44 :
45 : // class EditBox
46 : class EditBox : public Control
47 : {
48 : private:
49 :
50 : MultiLineEdit* pMEdit;
51 : Link aSelChangedLink;
52 : Selection aOldSel;
53 : sal_Bool bMouseFlag;
54 : DECL_LINK(ChangedHdl, void *);
55 :
56 : protected:
57 :
58 : virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
59 : virtual void SelectionChanged();
60 : virtual void Resize() SAL_OVERRIDE;
61 : virtual void GetFocus() SAL_OVERRIDE;
62 :
63 :
64 : public:
65 : EditBox( Window* pParent, const ResId& rResId );
66 :
67 : virtual ~EditBox();
68 :
69 0 : MultiLineEdit* GetEdit() {return pMEdit;}
70 :
71 0 : void SetSelChangedHdl( const Link& rLink ) { aSelChangedLink = rLink; }
72 : const Link& GetSelChangedHdl() const { return aSelChangedLink; }
73 :
74 : void UpdateOldSel();
75 : };
76 :
77 :
78 : // class ArgEdit
79 :
80 0 : class ArgEdit : public RefEdit
81 : {
82 : public:
83 : ArgEdit( Window* pParent, const ResId& rResId );
84 :
85 : void Init( ArgEdit* pPrevEdit, ArgEdit* pNextEdit,
86 : ScrollBar& rArgSlider, sal_uInt16 nArgCount );
87 :
88 : protected:
89 : virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
90 :
91 : private:
92 : ArgEdit* pEdPrev;
93 : ArgEdit* pEdNext;
94 : ScrollBar* pSlider;
95 : sal_uInt16 nArgs;
96 : };
97 :
98 :
99 :
100 : // class ArgInput
101 :
102 : class ArgInput
103 : {
104 : private:
105 :
106 : Link aFxClickLink;
107 : Link aRefClickLink;
108 : Link aFxFocusLink;
109 : Link aRefFocusLink;
110 : Link aEdFocusLink;
111 : Link aEdModifyLink;
112 :
113 : FixedText* pFtArg;
114 : ImageButton* pBtnFx;
115 : ArgEdit* pEdArg;
116 : RefButton* pRefBtn;
117 :
118 : DECL_LINK( FxBtnClickHdl, ImageButton* );
119 : DECL_LINK( RefBtnClickHdl,RefButton* );
120 : DECL_LINK( FxBtnFocusHdl, ImageButton* );
121 : DECL_LINK( RefBtnFocusHdl,RefButton* );
122 : DECL_LINK( EdFocusHdl, ArgEdit* );
123 : DECL_LINK( EdModifyHdl,ArgEdit* );
124 :
125 : protected:
126 :
127 : virtual void FxClick();
128 : virtual void RefClick();
129 : virtual void FxFocus();
130 : virtual void RefFocus();
131 : virtual void EdFocus();
132 : virtual void EdModify();
133 :
134 : public:
135 :
136 : ArgInput();
137 :
138 0 : virtual ~ArgInput() {}
139 :
140 : void InitArgInput ( FixedText* pftArg,
141 : ImageButton* pbtnFx,
142 : ArgEdit* pedArg,
143 : RefButton* prefBtn);
144 :
145 : void SetArgName(const OUString &aArg);
146 : OUString GetArgName();
147 : void SetArgNameFont(const Font&);
148 :
149 : void SetArgVal(const OUString &aVal);
150 : OUString GetArgVal();
151 :
152 : void SetArgSelection (const Selection& rSel);
153 : void ReplaceSelOfArg (const OUString& rStr);
154 :
155 0 : ArgEdit* GetArgEdPtr() {return pEdArg;}
156 :
157 :
158 0 : void SetFxClickHdl( const Link& rLink ) { aFxClickLink = rLink; }
159 : const Link& GetFxClickHdl() const { return aFxClickLink; }
160 :
161 : void SetRefClickHdl( const Link& rLink ) { aRefClickLink = rLink; }
162 : const Link& GetRefClickHdl() const { return aRefClickLink; }
163 :
164 0 : void SetFxFocusHdl( const Link& rLink ) { aFxFocusLink = rLink; }
165 : const Link& GetFxFocusHdl() const { return aFxFocusLink; }
166 :
167 : void SetRefFocusHdl( const Link& rLink ) { aRefFocusLink = rLink; }
168 : const Link& GetRefFocusHdl() const { return aRefFocusLink; }
169 :
170 0 : void SetEdFocusHdl( const Link& rLink ) { aEdFocusLink = rLink; }
171 : const Link& GetEdFocusHdl() const { return aEdFocusLink; }
172 :
173 0 : void SetEdModifyHdl( const Link& rLink ) { aEdModifyLink = rLink; }
174 : const Link& GetEdModifyHdl() const { return aEdModifyLink; }
175 :
176 : void Hide();
177 : void Show();
178 :
179 : void UpdateAccessibleNames();
180 : };
181 :
182 : }
183 : #endif // FORMULA_FORMULA_HELPER_HXX_INCLUDED
184 :
185 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|