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