Version 5.2.6.1, tag libreoffice-5.2.6.1
[LibreOffice.git] / dbaccess / source / ui / inc / sqledit.hxx
blobb408159300e8c6b2c871a405a9c759406b93af3d
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_SQLEDIT_HXX
20 #define INCLUDED_DBACCESS_SOURCE_UI_INC_SQLEDIT_HXX
22 #include "sal/config.h"
24 #include <rtl/ref.hxx>
25 #include <svtools/editsyntaxhighlighter.hxx>
26 #include <svl/lstner.hxx>
27 #include <svtools/colorcfg.hxx>
29 namespace com { namespace sun { namespace star { namespace beans {
30 class XMultiPropertySet;
31 } } } }
33 namespace dbaui
35 class OQueryTextView;
36 class OSqlEdit : public MultiLineEditSyntaxHighlight, public utl::ConfigurationListener
38 private:
39 class ChangesListener;
40 friend class ChangesListener;
42 Timer m_timerInvalidate;
43 Timer m_timerUndoActionCreation;
44 OUString m_strOrigText; // is restored on undo
45 VclPtr<OQueryTextView> m_pView;
46 bool m_bAccelAction; // is set on cut, copy, paste
47 bool m_bStopTimer;
48 svtools::ColorConfig m_ColorConfig;
50 rtl::Reference< ChangesListener > m_listener;
51 osl::Mutex m_mutex;
52 css::uno::Reference< css::beans::XMultiPropertySet > m_notifier;
54 DECL_LINK_TYPED(OnUndoActionTimer, Timer*, void);
55 DECL_LINK_TYPED(OnInvalidateTimer, Timer*, void);
57 private:
58 void ImplSetFont();
60 protected:
61 virtual void KeyInput( const KeyEvent& rKEvt ) override;
62 virtual void GetFocus() override;
64 DECL_LINK_TYPED(ModifyHdl, Edit&, void);
66 public:
67 OSqlEdit( OQueryTextView* pParent, WinBits nWinStyle = WB_LEFT | WB_VSCROLL |WB_BORDER);
68 virtual ~OSqlEdit();
69 virtual void dispose() override;
71 // Edit overridables
72 virtual void SetText(const OUString& rNewText) override;
73 using MultiLineEditSyntaxHighlight::SetText;
75 // own functionality
76 // Cut, Copy, Paste by Accel. runs the action in the Edit but also the
77 // corresponding slot in the View. Therefore, the action occurs twice.
78 // To prevent this, SlotExec in View can call this function.
79 bool IsInAccelAct() { return m_bAccelAction; }
81 void stopTimer();
82 void startTimer();
84 virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 ) override;
85 using MultiLineEditSyntaxHighlight::Notify;
89 #endif // INCLUDED_DBACCESS_SOURCE_UI_INC_SQLEDIT_HXX
92 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */