cid#1640468 Dereference after null check
[LibreOffice.git] / dbaccess / source / ui / inc / sqledit.hxx
blobd0f8672cc6982fcf7018fd30d498a1d37b77ffaa
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 #pragma once
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>
28 #include <mutex>
30 namespace com::sun::star::beans { class XMultiPropertySet; }
32 namespace dbaui
34 class SQLEditView final : public WeldEditView, public utl::ConfigurationListener
36 private:
37 class ChangesListener;
38 friend class ChangesListener;
40 std::unique_ptr<weld::ScrolledWindow> m_xScrolledWindow;
41 Link<LinkParamNone*,void> m_aModifyLink;
42 const svtools::ColorConfig m_aColorConfig;
43 Timer m_aUpdateDataTimer;
44 const SyntaxHighlighter m_aHighlighter;
45 svtools::ColorConfig m_ColorConfig;
46 rtl::Reference<SfxItemPool> m_pItemPool;
48 rtl::Reference<ChangesListener> m_listener;
49 std::mutex m_mutex;
50 css::uno::Reference<css::beans::XMultiPropertySet> m_notifier;
52 bool m_bInUpdate;
53 bool m_bDisableInternalUndo;
55 DECL_LINK(ModifyHdl, LinkParamNone*, void);
56 DECL_LINK(ImplUpdateDataHdl, Timer*, void);
57 DECL_LINK(ScrollHdl, weld::ScrolledWindow&, void);
58 DECL_LINK(EditStatusHdl, EditStatus&, void);
60 Color GetColorValue(TokenType aToken);
62 void ImplSetFont();
64 void DoBracketHilight(sal_uInt16 nKey);
66 static void SetItemPoolFont(SfxItemPool* pItemPool);
68 void UpdateData();
70 void SetScrollBarRange();
71 void DoScroll();
73 virtual void EditViewScrollStateChange() override;
75 public:
76 SQLEditView(std::unique_ptr<weld::ScrolledWindow> xScrolledWindow);
77 virtual void makeEditEngine() override;
78 virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
79 virtual ~SQLEditView() override;
81 virtual bool KeyInput(const KeyEvent& rKEvt) override;
82 virtual bool Command(const CommandEvent& rCEvt) override;
84 void SetTextAndUpdate(const OUString& rNewText);
86 void SetModifyHdl(const Link<LinkParamNone*,void>& rLink)
88 m_aModifyLink = rLink;
91 void DisableInternalUndo();
93 static Color GetSyntaxHighlightColor(const svtools::ColorConfig& rColorConfig, HighlighterLanguage eLanguage, TokenType aToken);
95 virtual void ConfigurationChanged(utl::ConfigurationBroadcaster*, ConfigurationHints) override;
100 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */