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