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 :
20 : #ifndef FORMULA_FUNCUTL_HXX
21 : #define FORMULA_FUNCUTL_HXX
22 :
23 : #include <vcl/fixed.hxx>
24 : #include <vcl/button.hxx>
25 : #include <vcl/edit.hxx>
26 : #include "formula/formuladllapi.h"
27 :
28 : namespace formula {
29 :
30 : class IControlReferenceHandler;
31 :
32 : class FORMULA_DLLPUBLIC RefEdit : public Edit
33 : {
34 : private:
35 : Timer aTimer;
36 : IControlReferenceHandler* pAnyRefDlg; // parent dialog
37 :
38 : DECL_LINK( UpdateHdl, void* );
39 :
40 : protected:
41 : virtual void KeyInput( const KeyEvent& rKEvt );
42 : virtual void GetFocus();
43 : virtual void LoseFocus();
44 :
45 : public:
46 : RefEdit( Window* _pParent,IControlReferenceHandler* pParent, const ResId& rResId );
47 : virtual ~RefEdit();
48 :
49 : void SetRefString( const XubString& rStr );
50 :
51 : /**
52 : * Flag reference valid or invalid, which in turn changes the visual
53 : * appearance of the control accordingly.
54 : */
55 : void SetRefValid(bool bValid);
56 :
57 : using Edit::SetText;
58 : virtual void SetText( const XubString& rStr );
59 : virtual void Modify();
60 :
61 : void StartUpdateData();
62 :
63 : void SetRefDialog( IControlReferenceHandler* pDlg );
64 : inline IControlReferenceHandler* GetRefDialog() { return pAnyRefDlg; }
65 : };
66 :
67 :
68 : //============================================================================
69 :
70 0 : class FORMULA_DLLPUBLIC RefButton : public ImageButton
71 : {
72 : private:
73 : Image aImgRefStart; /// Start reference input
74 : Image aImgRefDone; /// Stop reference input
75 : IControlReferenceHandler* pAnyRefDlg; // parent dialog
76 : RefEdit* pRefEdit; // zugeordnetes Edit-Control
77 :
78 : protected:
79 : virtual void Click();
80 : virtual void KeyInput( const KeyEvent& rKEvt );
81 : virtual void GetFocus();
82 : virtual void LoseFocus();
83 :
84 : public:
85 : RefButton( Window* _pParent, const ResId& rResId);
86 : RefButton( Window* _pParent, const ResId& rResId, RefEdit* pEdit ,IControlReferenceHandler* pDlg);
87 :
88 : void SetReferences( IControlReferenceHandler* pDlg, RefEdit* pEdit );
89 :
90 : void SetStartImage();
91 : void SetEndImage();
92 0 : inline void DoRef() { Click(); }
93 : };
94 :
95 : } // formula
96 :
97 : #endif // FORMULA_FUNCUTL_HXX
98 :
99 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|