Branch data 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 : : RefEdit( Window* pParent, const ResId& rResId );
48 : : virtual ~RefEdit();
49 : :
50 : : void SetRefString( const XubString& rStr );
51 : :
52 : : /**
53 : : * Flag reference valid or invalid, which in turn changes the visual
54 : : * appearance of the control accordingly.
55 : : */
56 : : void SetRefValid(bool bValid);
57 : :
58 : : using Edit::SetText;
59 : : virtual void SetText( const XubString& rStr );
60 : : virtual void Modify();
61 : :
62 : : void StartUpdateData();
63 : :
64 : : void SetRefDialog( IControlReferenceHandler* pDlg );
65 : : inline IControlReferenceHandler* GetRefDialog() { return pAnyRefDlg; }
66 : : };
67 : :
68 : :
69 : : //============================================================================
70 : :
71 [ # # ][ # # ]: 0 : class FORMULA_DLLPUBLIC RefButton : public ImageButton
[ # # ]
72 : : {
73 : : private:
74 : : Image aImgRefStart; /// Start reference input
75 : : Image aImgRefDone; /// Stop reference input
76 : : IControlReferenceHandler* pAnyRefDlg; // parent dialog
77 : : RefEdit* pRefEdit; // zugeordnetes Edit-Control
78 : :
79 : : protected:
80 : : virtual void Click();
81 : : virtual void KeyInput( const KeyEvent& rKEvt );
82 : : virtual void GetFocus();
83 : : virtual void LoseFocus();
84 : :
85 : : public:
86 : : RefButton( Window* _pParent, const ResId& rResId);
87 : : RefButton( Window* _pParent, const ResId& rResId, RefEdit* pEdit ,IControlReferenceHandler* pDlg);
88 : :
89 : : void SetReferences( IControlReferenceHandler* pDlg, RefEdit* pEdit );
90 : :
91 : : void SetStartImage();
92 : : void SetEndImage();
93 : 0 : inline void DoRef() { Click(); }
94 : : };
95 : :
96 : : } // formula
97 : :
98 : : #endif // FORMULA_FUNCUTL_HXX
99 : :
100 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|