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 : VclPtr<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_TYPED(OnUndoActionTimer, Timer*, void);
57 : DECL_LINK_TYPED(OnInvalidateTimer, Timer*, 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 : virtual void dispose() SAL_OVERRIDE;
72 :
73 : // Edit overridables
74 : virtual void SetText(const OUString& rNewText) SAL_OVERRIDE;
75 : using MultiLineEditSyntaxHighlight::SetText;
76 :
77 : // own functionality
78 : // Cut, Copy, Paste by Accel. runs the action in the Edit but also the
79 : // corresponding slot in the View. Therefore, the action occurs twice.
80 : // To prevent this, SlotExec in View can call this function.
81 0 : bool IsInAccelAct() { return m_bAccelAction; }
82 :
83 : void SetTextModifyHdl(const Link<>& lnk) { m_lnkTextModifyHdl = lnk; }
84 : // please don't use SetModifyHdl, I need it for myself, this here is called from the handler set with that
85 : // the link gets a pointer-to-string, which is invalid after the link
86 :
87 : void stopTimer();
88 : void startTimer();
89 :
90 : virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 ) SAL_OVERRIDE;
91 : using MultiLineEditSyntaxHighlight::Notify;
92 : };
93 : }
94 :
95 : #endif // INCLUDED_DBACCESS_SOURCE_UI_INC_SQLEDIT_HXX
96 :
97 :
98 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|