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 .
21 #include <sal/config.h>
23 #include <comphelper/syntaxhighlight.hxx>
24 #include <rtl/ref.hxx>
25 #include <svtools/colorcfg.hxx>
26 #include <svx/weldeditview.hxx>
27 #include <vcl/timer.hxx>
29 namespace com::sun::star::beans
{ class XMultiPropertySet
; }
33 class SQLEditView final
: public WeldEditView
, public utl::ConfigurationListener
36 class ChangesListener
;
37 friend class ChangesListener
;
39 std::unique_ptr
<weld::ScrolledWindow
> m_xScrolledWindow
;
40 Link
<LinkParamNone
*,void> m_aModifyLink
;
41 const svtools::ColorConfig m_aColorConfig
;
42 Timer m_aUpdateDataTimer
;
43 const SyntaxHighlighter m_aHighlighter
;
44 svtools::ColorConfig m_ColorConfig
;
45 rtl::Reference
<SfxItemPool
> m_pItemPool
;
47 rtl::Reference
<ChangesListener
> m_listener
;
49 css::uno::Reference
<css::beans::XMultiPropertySet
> m_notifier
;
52 bool m_bDisableInternalUndo
;
54 DECL_LINK(ModifyHdl
, LinkParamNone
*, void);
55 DECL_LINK(ImplUpdateDataHdl
, Timer
*, void);
56 DECL_LINK(ScrollHdl
, weld::ScrolledWindow
&, void);
57 DECL_LINK(EditStatusHdl
, EditStatus
&, void);
59 Color
GetColorValue(TokenType aToken
);
63 void DoBracketHilight(sal_uInt16 nKey
);
65 static void SetItemPoolFont(SfxItemPool
* pItemPool
);
69 void SetScrollBarRange();
72 virtual void EditViewScrollStateChange() override
;
75 SQLEditView(std::unique_ptr
<weld::ScrolledWindow
> xScrolledWindow
);
76 virtual void makeEditEngine() override
;
77 virtual void SetDrawingArea(weld::DrawingArea
* pDrawingArea
) override
;
78 virtual ~SQLEditView() override
;
80 virtual bool KeyInput(const KeyEvent
& rKEvt
) override
;
81 virtual bool Command(const CommandEvent
& rCEvt
) override
;
83 void SetTextAndUpdate(const OUString
& rNewText
);
85 void SetModifyHdl(const Link
<LinkParamNone
*,void>& rLink
)
87 m_aModifyLink
= rLink
;
90 void DisableInternalUndo();
92 static Color
GetSyntaxHighlightColor(const svtools::ColorConfig
& rColorConfig
, HighlighterLanguage eLanguage
, TokenType aToken
);
94 virtual void ConfigurationChanged(utl::ConfigurationBroadcaster
*, ConfigurationHints
) override
;
99 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */