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 INCLUDED_FORMULA_FUNCUTL_HXX
21 : #define INCLUDED_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 : Idle aIdle;
36 : IControlReferenceHandler* pAnyRefDlg; // parent dialog
37 : VclPtr<vcl::Window> pLabelWidget;
38 :
39 : DECL_LINK_TYPED( UpdateHdl, Idle*, void );
40 :
41 : protected:
42 : virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
43 : virtual void GetFocus() SAL_OVERRIDE;
44 : virtual void LoseFocus() SAL_OVERRIDE;
45 :
46 : public:
47 : RefEdit( vcl::Window* _pParent,IControlReferenceHandler* pParent, vcl::Window* pShrinkModeLabel, const ResId& rResId );
48 : RefEdit( vcl::Window* _pParent, vcl::Window* pShrinkModeLabel, WinBits nStyle = WB_BORDER );
49 :
50 : virtual ~RefEdit();
51 : virtual void dispose() SAL_OVERRIDE;
52 :
53 : void SetRefString( const OUString& rStr );
54 :
55 : /**
56 : * Flag reference valid or invalid, which in turn changes the visual
57 : * appearance of the control accordingly.
58 : */
59 : void SetRefValid(bool bValid);
60 :
61 : using Edit::SetText;
62 :
63 : void SetText( const OUString& rStr ) SAL_OVERRIDE;
64 : virtual void Modify() SAL_OVERRIDE;
65 :
66 : void StartUpdateData();
67 :
68 : void SetReferences( IControlReferenceHandler* pDlg, vcl::Window *pLabelWidget );
69 :
70 : IControlReferenceHandler* GetRefDialog()
71 : {
72 : return pAnyRefDlg;
73 : }
74 :
75 0 : vcl::Window* GetLabelWidgetForShrinkMode()
76 : {
77 0 : return pLabelWidget;
78 : }
79 : };
80 :
81 :
82 : class FORMULA_DLLPUBLIC RefButton : public ImageButton
83 : {
84 : private:
85 : Image aImgRefStart; // Start reference input
86 : Image aImgRefDone; // Stop reference input
87 : OUString aShrinkQuickHelp;
88 : OUString aExpandQuickHelp;
89 : IControlReferenceHandler* pAnyRefDlg; // parent dialog
90 : VclPtr<RefEdit> pRefEdit; // zugeordnetes Edit-Control
91 :
92 : protected:
93 : virtual void Click() SAL_OVERRIDE;
94 : virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
95 : virtual void GetFocus() SAL_OVERRIDE;
96 : virtual void LoseFocus() SAL_OVERRIDE;
97 :
98 : public:
99 : RefButton(vcl::Window* _pParent, WinBits nStyle = 0);
100 : virtual ~RefButton();
101 : virtual void dispose() SAL_OVERRIDE;
102 : void SetReferences( IControlReferenceHandler* pDlg, RefEdit* pEdit );
103 : void SetStartImage();
104 : void SetEndImage();
105 0 : void DoRef()
106 : {
107 0 : Click();
108 0 : }
109 : };
110 :
111 : } // formula
112 :
113 : #endif // INCLUDED_FORMULA_FUNCUTL_HXX
114 :
115 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|