1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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
;
36 class OSqlEdit
: public MultiLineEditSyntaxHighlight
, utl::ConfigurationListener
39 class ChangesListener
;
40 friend class ChangesListener
;
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
49 svtools::ColorConfig m_ColorConfig
;
51 rtl::Reference
< ChangesListener
> m_listener
;
53 com::sun::star::uno::Reference
<
54 com::sun::star::beans::XMultiPropertySet
> m_notifier
;
56 DECL_LINK_TYPED(OnUndoActionTimer
, Timer
*, void);
57 DECL_LINK_TYPED(OnInvalidateTimer
, Timer
*, void);
63 virtual void KeyInput( const KeyEvent
& rKEvt
) SAL_OVERRIDE
;
64 virtual void GetFocus() SAL_OVERRIDE
;
66 DECL_LINK(ModifyHdl
, void*);
69 OSqlEdit( OQueryTextView
* pParent
, WinBits nWinStyle
= WB_LEFT
| WB_VSCROLL
|WB_BORDER
);
71 virtual void dispose() SAL_OVERRIDE
;
74 virtual void SetText(const OUString
& rNewText
) SAL_OVERRIDE
;
75 using MultiLineEditSyntaxHighlight::SetText
;
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 bool IsInAccelAct() { return m_bAccelAction
; }
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
90 virtual void ConfigurationChanged( utl::ConfigurationBroadcaster
*, sal_uInt32
) SAL_OVERRIDE
;
91 using MultiLineEditSyntaxHighlight::Notify
;
95 #endif // INCLUDED_DBACCESS_SOURCE_UI_INC_SQLEDIT_HXX
98 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */