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_DBACCESS_SOURCE_UI_INC_SQLEDIT_HXX
20 : #define INCLUDED_DBACCESS_SOURCE_UI_INC_SQLEDIT_HXX
21 :
22 : #include "sal/config.h"
23 :
24 : #include <rtl/ref.hxx>
25 : #include <svtools/editsyntaxhighlighter.hxx>
26 : #include <svl/lstner.hxx>
27 : #include <svtools/colorcfg.hxx>
28 :
29 : namespace com { namespace sun { namespace star { namespace beans {
30 : class XMultiPropertySet;
31 : } } } }
32 :
33 : namespace dbaui
34 : {
35 : class OQueryTextView;
36 : class OSqlEdit : public MultiLineEditSyntaxHighlight, utl::ConfigurationListener
37 : {
38 : private:
39 : class ChangesListener;
40 : friend class ChangesListener;
41 :
42 : Timer m_timerInvalidate;
43 : Timer m_timerUndoActionCreation;
44 : Link m_lnkTextModifyHdl;
45 : OUString m_strOrigText; // is restored on undo
46 : OQueryTextView* m_pView;
47 : bool m_bAccelAction; // is set on cut, copy, paste
48 : bool m_bStopTimer;
49 : svtools::ColorConfig m_ColorConfig;
50 :
51 : rtl::Reference< ChangesListener > m_listener;
52 : osl::Mutex m_mutex;
53 : com::sun::star::uno::Reference<
54 : com::sun::star::beans::XMultiPropertySet > m_notifier;
55 :
56 : DECL_LINK(OnUndoActionTimer, void*);
57 : DECL_LINK(OnInvalidateTimer, void*);
58 :
59 : private:
60 : void ImplSetFont();
61 :
62 : protected:
63 : virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
64 : virtual void GetFocus() SAL_OVERRIDE;
65 :
66 : DECL_LINK(ModifyHdl, void*);
67 :
68 : public:
69 : OSqlEdit( OQueryTextView* pParent, WinBits nWinStyle = WB_LEFT | WB_VSCROLL |WB_BORDER);
70 : virtual ~OSqlEdit();
71 :
72 : // Edit overridables
73 : virtual void SetText(const OUString& rNewText) SAL_OVERRIDE;
74 : using MultiLineEditSyntaxHighlight::SetText;
75 :
76 : // own functionality
77 : // Cut, Copy, Paste by Accel. runs the action in the Edit but also the
78 : // corresponding slot in the View. Therefore, the action occurs twice.
79 : // To prevent this, SlotExec in View can call this function.
80 0 : bool IsInAccelAct() { return m_bAccelAction; }
81 :
82 : void SetTextModifyHdl(const Link& lnk) { m_lnkTextModifyHdl = lnk; }
83 : // please don't use SetModifyHdl, I need it for myself, this here is called from the handler set with that
84 : // the link gets a pointer-to-string, which is invalid after the link
85 :
86 : void stopTimer();
87 : void startTimer();
88 :
89 : virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 ) SAL_OVERRIDE;
90 : using MultiLineEditSyntaxHighlight::Notify;
91 : };
92 : }
93 :
94 : #endif // INCLUDED_DBACCESS_SOURCE_UI_INC_SQLEDIT_HXX
95 :
96 :
97 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|