dbaccess/source/ui/control/sqledit.cxx        |  173 +++++++++++++++++++++++-
 dbaccess/source/ui/dlg/directsql.cxx          |    4 
 dbaccess/source/ui/inc/sqledit.hxx            |   23 ++-
 include/svtools/editsyntaxhighlighter.hxx     |   55 -------
 solenv/clang-format/excludelist               |    2 
 svtools/Library_svt.mk                        |    1 
 svtools/source/edit/editsyntaxhighlighter.cxx |  180 --------------------------
 7 files changed, 181 insertions(+), 257 deletions(-)

New commits:
commit 4b97463059e9a616f9eedf142e73d49fc874d4d6
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Tue Aug 18 10:35:32 2020 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Tue Aug 18 13:50:01 2020 +0200

    merge OSqlEdit and MultiLineEditSyntaxHighlight
    
    Change-Id: Ie3e38afd976620068c644809c4a88cd3809759a5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100907
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/dbaccess/source/ui/control/sqledit.cxx 
b/dbaccess/source/ui/control/sqledit.cxx
index ccbe210afd5f..aa1745369edd 100644
--- a/dbaccess/source/ui/control/sqledit.cxx
+++ b/dbaccess/source/ui/control/sqledit.cxx
@@ -32,11 +32,14 @@
 #include <undosqledit.hxx>
 #include <QueryDesignView.hxx>
 #include <svx/svxids.hrc>
-#include <vcl/settings.hxx>
 #include <cppuhelper/implbase.hxx>
 #include <i18nlangtag/languagetag.hxx>
 #include <vcl/event.hxx>
+#include <vcl/settings.hxx>
 #include <vcl/svapp.hxx>
+#include <vcl/txtattr.hxx>
+#include <vcl/textview.hxx>
+#include <vcl/xtextedt.hxx>
 
 using namespace dbaui;
 
@@ -65,12 +68,15 @@ private:
     OSqlEdit & editor_;
 };
 
-OSqlEdit::OSqlEdit( OQueryTextView* pParent ) :
-    MultiLineEditSyntaxHighlight( pParent, WB_LEFT | WB_VSCROLL | WB_BORDER )
-    ,m_pView(pParent)
-    ,m_bAccelAction( false )
-    ,m_bStopTimer(false )
+OSqlEdit::OSqlEdit(OQueryTextView* pParent)
+    : VclMultiLineEdit(pParent, WB_LEFT | WB_VSCROLL | WB_BORDER)
+    , aHighlighter(HighlighterLanguage::SQL)
+    , m_pView(pParent)
+    , m_bAccelAction( false )
+    , m_bStopTimer(false )
 {
+    EnableUpdateData(300);
+
     SetHelpId( HID_CTL_QRYSQLEDIT );
     SetModifyHdl( LINK(this, OSqlEdit, ModifyHdl) );
 
@@ -103,6 +109,148 @@ OSqlEdit::OSqlEdit( OQueryTextView* pParent ) :
     EnableFocusSelectionHide( false );
 }
 
+void OSqlEdit::DoBracketHilight(sal_uInt16 nKey)
+{
+    TextSelection aCurrentPos = GetTextView()->GetSelection();
+    sal_Int32 nStartPos = aCurrentPos.GetStart().GetIndex();
+    const sal_uInt32 nStartPara = aCurrentPos.GetStart().GetPara();
+    sal_uInt16 nCount = 0;
+    int nChar = -1;
+
+    switch (nKey)
+    {
+        case '\'':  // no break
+        case '"':
+        {
+            nChar = nKey;
+            break;
+        }
+        case '}' :
+        {
+            nChar = '{';
+            break;
+        }
+        case ')':
+        {
+            nChar = '(';
+            break;
+        }
+        case ']':
+        {
+            nChar = '[';
+            break;
+        }
+    }
+
+    if (nChar == -1)
+        return;
+
+    sal_uInt32 nPara = nStartPara;
+    do
+    {
+        if (nPara == nStartPara && nStartPos == 0)
+            continue;
+
+        OUString aLine( GetTextEngine()->GetText( nPara ) );
+
+        if (aLine.isEmpty())
+            continue;
+
+        for (sal_Int32 i = (nPara==nStartPara) ? nStartPos-1 : 
aLine.getLength()-1; i>0; --i)
+        {
+            if (aLine[i] == nChar)
+            {
+                if (!nCount)
+                {
+                    GetTextEngine()->SetAttrib( TextAttribFontWeight( 
WEIGHT_ULTRABOLD ), nPara, i, i+1 );
+                    GetTextEngine()->SetAttrib( TextAttribFontColor( 
Color(0,0,0) ), nPara, i, i+1 );
+                    GetTextEngine()->SetAttrib( TextAttribFontWeight( 
WEIGHT_ULTRABOLD ), nStartPara, nStartPos, nStartPos );
+                    GetTextEngine()->SetAttrib( TextAttribFontColor( 
Color(0,0,0) ), nStartPara, nStartPos, nStartPos );
+                    return;
+                }
+                else
+                    --nCount;
+            }
+            if (aLine[i] == nKey)
+                ++nCount;
+        }
+    } while (nPara--);
+}
+
+bool OSqlEdit::PreNotify( NotifyEvent& rNEvt )
+{
+    if ( rNEvt.GetType() == MouseNotifyEvent::KEYINPUT )
+        DoBracketHilight(rNEvt.GetKeyEvent()->GetCharCode());
+
+    return VclMultiLineEdit::PreNotify(rNEvt);
+}
+
+Color OSqlEdit::GetSyntaxHighlightColor(const svtools::ColorConfig& 
rColorConfig, HighlighterLanguage eLanguage, TokenType aToken)
+{
+    Color aColor;
+    switch (eLanguage)
+    {
+        case HighlighterLanguage::SQL:
+        {
+            switch (aToken)
+            {
+                case TokenType::Identifier: aColor = 
rColorConfig.GetColorValue(svtools::SQLIDENTIFIER).nColor; break;
+                case TokenType::Number:     aColor = 
rColorConfig.GetColorValue(svtools::SQLNUMBER).nColor; break;
+                case TokenType::String:     aColor = 
rColorConfig.GetColorValue(svtools::SQLSTRING).nColor; break;
+                case TokenType::Operator:   aColor = 
rColorConfig.GetColorValue(svtools::SQLOPERATOR).nColor; break;
+                case TokenType::Keywords:   aColor = 
rColorConfig.GetColorValue(svtools::SQLKEYWORD).nColor; break;
+                case TokenType::Parameter:  aColor = 
rColorConfig.GetColorValue(svtools::SQLPARAMETER).nColor; break;
+                case TokenType::Comment:    aColor = 
rColorConfig.GetColorValue(svtools::SQLCOMMENT).nColor; break;
+                default:            aColor = Color(0,0,0);
+            }
+            break;
+        }
+        case HighlighterLanguage::Basic:
+        {
+            switch (aToken)
+            {
+                case TokenType::Identifier: aColor = Color(255,0,0); break;
+                case TokenType::Comment:    aColor = Color(0,0,45); break;
+                case TokenType::Number:     aColor = Color(204,102,204); break;
+                case TokenType::String:     aColor = Color(0,255,45); break;
+                case TokenType::Operator:   aColor = Color(0,0,100); break;
+                case TokenType::Keywords:   aColor = Color(0,0,255); break;
+                case TokenType::Error :     aColor = Color(0,255,255); break;
+                default:            aColor = Color(0,0,0);
+            }
+            break;
+        }
+        default: aColor = Color(0,0,0);
+
+    }
+    return aColor;
+}
+
+Color OSqlEdit::GetColorValue(TokenType aToken)
+{
+    return GetSyntaxHighlightColor(m_aColorConfig, aHighlighter.GetLanguage(), 
aToken);
+}
+
+void OSqlEdit::UpdateData()
+{
+    // syntax highlighting
+    // this must be possible improved by using notifychange correctly
+    bool bTempModified = GetTextEngine()->IsModified();
+    for (sal_uInt32 nLine=0; nLine < GetTextEngine()->GetParagraphCount(); 
++nLine)
+    {
+        OUString aLine( GetTextEngine()->GetText( nLine ) );
+        GetTextEngine()->RemoveAttribs( nLine );
+        std::vector<HighlightPortion> aPortions;
+        aHighlighter.getHighlightPortions( aLine, aPortions );
+        for (auto const& portion : aPortions)
+        {
+            GetTextEngine()->SetAttrib( TextAttribFontColor( 
GetColorValue(portion.tokenType) ), nLine, portion.nBegin, portion.nEnd );
+        }
+    }
+    GetTextView()->ShowCursor( false );
+    GetTextEngine()->SetModified(bTempModified);
+}
+
 OSqlEdit::~OSqlEdit()
 {
     disposeOnce();
@@ -122,7 +270,7 @@ void OSqlEdit::dispose()
     }
     m_ColorConfig.RemoveListener(this);
     m_pView.clear();
-    MultiLineEditSyntaxHighlight::dispose();
+    VclMultiLineEdit::dispose();
 }
 
 void OSqlEdit::KeyInput( const KeyEvent& rKEvt )
@@ -136,17 +284,16 @@ void OSqlEdit::KeyInput( const KeyEvent& rKEvt )
     if( 
(aKeyFunc==KeyFuncType::CUT)||(aKeyFunc==KeyFuncType::COPY)||(aKeyFunc==KeyFuncType::PASTE)
 )
         m_bAccelAction = true;
 
-    MultiLineEditSyntaxHighlight::KeyInput( rKEvt );
+    VclMultiLineEdit::KeyInput( rKEvt );
 
     if( m_bAccelAction )
         m_bAccelAction = false;
 }
 
-
 void OSqlEdit::GetFocus()
 {
     m_strOrigText  =GetText();
-    MultiLineEditSyntaxHighlight::GetFocus();
+    VclMultiLineEdit::GetFocus();
 }
 
 IMPL_LINK_NOARG(OSqlEdit, OnUndoActionTimer, Timer *, void)
@@ -200,7 +347,9 @@ void OSqlEdit::SetText(const OUString& rNewText)
         LINK(this, OSqlEdit, OnUndoActionTimer).Call(nullptr);
     }
 
-    MultiLineEditSyntaxHighlight::SetText(rNewText);
+    VclMultiLineEdit::SetText(rNewText);
+    UpdateData();
+
     m_strOrigText  =rNewText;
 }
 
@@ -222,7 +371,7 @@ void OSqlEdit::ConfigurationChanged( 
utl::ConfigurationBroadcaster* pOption, Con
 {
     assert( pOption == &m_ColorConfig );
     (void) pOption; // avoid warnings
-    MultiLineEditSyntaxHighlight::UpdateData();
+    VclMultiLineEdit::UpdateData();
 }
 
 void OSqlEdit::ImplSetFont()
diff --git a/dbaccess/source/ui/dlg/directsql.cxx 
b/dbaccess/source/ui/dlg/directsql.cxx
index 5e7b579df72e..f4d59fea8820 100644
--- a/dbaccess/source/ui/dlg/directsql.cxx
+++ b/dbaccess/source/ui/dlg/directsql.cxx
@@ -19,6 +19,7 @@
 
 #include <core_resource.hxx>
 #include <directsql.hxx>
+#include <sqledit.hxx>
 #include <strings.hrc>
 #include <comphelper/types.hxx>
 #include <editeng/colritem.hxx>
@@ -26,7 +27,6 @@
 #include <editeng/eeitem.hxx>
 #include <osl/mutex.hxx>
 #include <svl/itemset.hxx>
-#include <svtools/editsyntaxhighlighter.hxx>
 #include <tools/diagnose_ex.h>
 #include <vcl/event.hxx>
 #include <vcl/svapp.hxx>
@@ -449,7 +449,7 @@ namespace dbaui
 
     Color DirectSQLDialog::GetColorValue(TokenType aToken)
     {
-        return 
MultiLineEditSyntaxHighlight::GetSyntaxHighlightColor(m_aColorConfig, 
m_aHighlighter.GetLanguage(), aToken);
+        return OSqlEdit::GetSyntaxHighlightColor(m_aColorConfig, 
m_aHighlighter.GetLanguage(), aToken);
     }
 
     IMPL_LINK_NOARG(DirectSQLDialog, ImplUpdateDataHdl, Timer*, void)
diff --git a/dbaccess/source/ui/inc/sqledit.hxx 
b/dbaccess/source/ui/inc/sqledit.hxx
index 8337ae398c64..478a248bf78b 100644
--- a/dbaccess/source/ui/inc/sqledit.hxx
+++ b/dbaccess/source/ui/inc/sqledit.hxx
@@ -21,21 +21,25 @@
 
 #include <sal/config.h>
 
+#include <comphelper/syntaxhighlight.hxx>
 #include <rtl/ref.hxx>
-#include <svtools/editsyntaxhighlighter.hxx>
 #include <svtools/colorcfg.hxx>
+#include <vcl/vclmedit.hxx>
 
 namespace com::sun::star::beans { class XMultiPropertySet; }
 
 namespace dbaui
 {
     class OQueryTextView;
-    class OSqlEdit final : public MultiLineEditSyntaxHighlight, public 
utl::ConfigurationListener
+    class OSqlEdit final : public VclMultiLineEdit, public 
utl::ConfigurationListener
     {
     private:
         class ChangesListener;
         friend class ChangesListener;
 
+        SyntaxHighlighter    aHighlighter;
+        svtools::ColorConfig m_aColorConfig;
+
         Timer                   m_timerInvalidate;
         Timer                   m_timerUndoActionCreation;
         OUString                m_strOrigText;      // is restored on undo
@@ -51,8 +55,10 @@ namespace dbaui
         DECL_LINK(OnUndoActionTimer, Timer*, void);
         DECL_LINK(OnInvalidateTimer, Timer*, void);
 
-        void            ImplSetFont();
+        void ImplSetFont();
+        void DoBracketHilight(sal_uInt16 aKey);
 
+        virtual bool PreNotify( NotifyEvent& rNEvt ) override;
         virtual void KeyInput( const KeyEvent& rKEvt ) override;
         virtual void GetFocus() override;
 
@@ -65,12 +71,19 @@ namespace dbaui
 
         // Edit overridables
         virtual void SetText(const OUString& rNewText) override;
-        using MultiLineEditSyntaxHighlight::SetText;
+        virtual void SetText( const OUString& rStr, const Selection& 
rNewSelection ) override
+                    { SetText( rStr ); SetSelection( rNewSelection ); }
+
+        virtual void UpdateData() override;
+
+        static Color GetSyntaxHighlightColor(const svtools::ColorConfig& 
rColorConfig, HighlighterLanguage eLanguage, TokenType aToken);
+
+        Color GetColorValue(TokenType aToken);
 
         // own functionality
         // Cut, Copy, Paste by Accel. runs the action in the Edit but also the
         // corresponding slot in the View. Therefore, the action occurs twice.
-       // To prevent this, SlotExec in View can call this function.
+        // To prevent this, SlotExec in View can call this function.
         bool IsInAccelAct() const { return m_bAccelAction; }
 
         void stopTimer();
diff --git a/include/svtools/editsyntaxhighlighter.hxx 
b/include/svtools/editsyntaxhighlighter.hxx
deleted file mode 100644
index aaa2ee61be46..000000000000
--- a/include/svtools/editsyntaxhighlighter.hxx
+++ /dev/null
@@ -1,55 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef INCLUDED_SVTOOLS_EDITSYNTAXHIGHLIGHTER_HXX
-#define INCLUDED_SVTOOLS_EDITSYNTAXHIGHLIGHTER_HXX
-
-#include <comphelper/syntaxhighlight.hxx>
-#include <vcl/vclmedit.hxx>
-#include <svtools/svtdllapi.h>
-#include <svtools/colorcfg.hxx>
-
-class SVT_DLLPUBLIC MultiLineEditSyntaxHighlight : public VclMultiLineEdit
-{
-    private:
-        SyntaxHighlighter    aHighlighter;
-        svtools::ColorConfig m_aColorConfig;
-
-    private:
-        void DoBracketHilight(sal_uInt16 aKey);
-
-    protected:
-        virtual bool PreNotify( NotifyEvent& rNEvt ) override;
-
-    public:
-        MultiLineEditSyntaxHighlight( vcl::Window* pParent, WinBits nWinStyle 
= WB_LEFT | WB_BORDER , HighlighterLanguage aLanguage = 
HighlighterLanguage::SQL);
-
-        virtual void UpdateData() override;
-        virtual void SetText(const OUString& rNewText) override;
-        virtual void SetText( const OUString& rStr, const Selection& 
rNewSelection ) override
-                    { SetText( rStr ); SetSelection( rNewSelection ); }
-
-        static Color GetSyntaxHighlightColor(const svtools::ColorConfig& 
rColorConfig, HighlighterLanguage eLanguage, TokenType aToken);
-
-        Color GetColorValue(TokenType aToken);
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist
index bd6df84c5b3d..5150456678a5 100644
--- a/solenv/clang-format/excludelist
+++ b/solenv/clang-format/excludelist
@@ -6567,7 +6567,6 @@ include/svtools/ctrlbox.hxx
 include/svtools/ctrltool.hxx
 include/svtools/dialogclosedlistener.hxx
 include/svtools/editbrowsebox.hxx
-include/svtools/editsyntaxhighlighter.hxx
 include/svtools/ehdl.hxx
 include/svtools/embedhlp.hxx
 include/svtools/embedtransfer.hxx
@@ -13021,7 +13020,6 @@ svtools/source/dialogs/colrdlg.cxx
 svtools/source/dialogs/insdlg.cxx
 svtools/source/dialogs/prnsetup.cxx
 svtools/source/dialogs/restartdialog.cxx
-svtools/source/edit/editsyntaxhighlighter.cxx
 svtools/source/filter/DocumentToGraphicRenderer.cxx
 svtools/source/filter/SvFilterOptionsDialog.cxx
 svtools/source/filter/exportdialog.cxx
diff --git a/svtools/Library_svt.mk b/svtools/Library_svt.mk
index 47c645802000..752c2ce27d0e 100644
--- a/svtools/Library_svt.mk
+++ b/svtools/Library_svt.mk
@@ -111,7 +111,6 @@ $(eval $(call gb_Library_add_exception_objects,svt,\
     svtools/source/dialogs/prnsetup \
     svtools/source/dialogs/restartdialog \
     svtools/source/dialogs/ServerDetailsControls \
-    svtools/source/edit/editsyntaxhighlighter \
     svtools/source/filter/SvFilterOptionsDialog \
     svtools/source/filter/DocumentToGraphicRenderer \
     svtools/source/filter/exportdialog \
diff --git a/svtools/source/edit/editsyntaxhighlighter.cxx 
b/svtools/source/edit/editsyntaxhighlighter.cxx
deleted file mode 100644
index b32d80e1a430..000000000000
--- a/svtools/source/edit/editsyntaxhighlighter.cxx
+++ /dev/null
@@ -1,180 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <vcl/event.hxx>
-#include <vcl/xtextedt.hxx>
-#include <vcl/textview.hxx>
-#include <svtools/editsyntaxhighlighter.hxx>
-#include <vcl/txtattr.hxx>
-
-MultiLineEditSyntaxHighlight::MultiLineEditSyntaxHighlight( vcl::Window* 
pParent, WinBits nWinStyle,
-    HighlighterLanguage aLanguage): VclMultiLineEdit(pParent,nWinStyle), 
aHighlighter(aLanguage)
-{
-    EnableUpdateData(300);
-}
-
-void MultiLineEditSyntaxHighlight::SetText(const OUString& rNewText)
-{
-    VclMultiLineEdit::SetText(rNewText);
-    UpdateData();
-}
-
-void MultiLineEditSyntaxHighlight::DoBracketHilight(sal_uInt16 nKey)
-{
-    TextSelection aCurrentPos = GetTextView()->GetSelection();
-    sal_Int32 nStartPos = aCurrentPos.GetStart().GetIndex();
-    const sal_uInt32 nStartPara = aCurrentPos.GetStart().GetPara();
-    sal_uInt16 nCount = 0;
-    int nChar = -1;
-
-    switch (nKey)
-    {
-        case '\'':  // no break
-        case '"':
-        {
-            nChar = nKey;
-            break;
-        }
-        case '}' :
-        {
-            nChar = '{';
-            break;
-        }
-        case ')':
-        {
-            nChar = '(';
-            break;
-        }
-        case ']':
-        {
-            nChar = '[';
-            break;
-        }
-    }
-
-    if (nChar == -1)
-        return;
-
-    sal_uInt32 nPara = nStartPara;
-    do
-    {
-        if (nPara == nStartPara && nStartPos == 0)
-            continue;
-
-        OUString aLine( GetTextEngine()->GetText( nPara ) );
-
-        if (aLine.isEmpty())
-            continue;
-
-        for (sal_Int32 i = (nPara==nStartPara) ? nStartPos-1 : 
aLine.getLength()-1; i>0; --i)
-        {
-            if (aLine[i] == nChar)
-            {
-                if (!nCount)
-                {
-                    GetTextEngine()->SetAttrib( TextAttribFontWeight( 
WEIGHT_ULTRABOLD ), nPara, i, i+1 );
-                    GetTextEngine()->SetAttrib( TextAttribFontColor( 
Color(0,0,0) ), nPara, i, i+1 );
-                    GetTextEngine()->SetAttrib( TextAttribFontWeight( 
WEIGHT_ULTRABOLD ), nStartPara, nStartPos, nStartPos );
-                    GetTextEngine()->SetAttrib( TextAttribFontColor( 
Color(0,0,0) ), nStartPara, nStartPos, nStartPos );
-                    return;
-                }
-                else
-                    --nCount;
-            }
-            if (aLine[i] == nKey)
-                ++nCount;
-        }
-    } while (nPara--);
-}
-
-bool MultiLineEditSyntaxHighlight::PreNotify( NotifyEvent& rNEvt )
-{
-    if ( rNEvt.GetType() == MouseNotifyEvent::KEYINPUT )
-        DoBracketHilight(rNEvt.GetKeyEvent()->GetCharCode());
-
-    return VclMultiLineEdit::PreNotify(rNEvt);
-}
-
-Color MultiLineEditSyntaxHighlight::GetSyntaxHighlightColor(const 
svtools::ColorConfig& rColorConfig, HighlighterLanguage eLanguage, TokenType 
aToken)
-{
-    Color aColor;
-    switch (eLanguage)
-    {
-        case HighlighterLanguage::SQL:
-        {
-            switch (aToken)
-            {
-                case TokenType::Identifier: aColor = 
rColorConfig.GetColorValue(svtools::SQLIDENTIFIER).nColor; break;
-                case TokenType::Number:     aColor = 
rColorConfig.GetColorValue(svtools::SQLNUMBER).nColor; break;
-                case TokenType::String:     aColor = 
rColorConfig.GetColorValue(svtools::SQLSTRING).nColor; break;
-                case TokenType::Operator:   aColor = 
rColorConfig.GetColorValue(svtools::SQLOPERATOR).nColor; break;
-                case TokenType::Keywords:   aColor = 
rColorConfig.GetColorValue(svtools::SQLKEYWORD).nColor; break;
-                case TokenType::Parameter:  aColor = 
rColorConfig.GetColorValue(svtools::SQLPARAMETER).nColor; break;
-                case TokenType::Comment:    aColor = 
rColorConfig.GetColorValue(svtools::SQLCOMMENT).nColor; break;
-                default:            aColor = Color(0,0,0);
-            }
-            break;
-        }
-        case HighlighterLanguage::Basic:
-        {
-            switch (aToken)
-            {
-                case TokenType::Identifier: aColor = Color(255,0,0); break;
-                case TokenType::Comment:    aColor = Color(0,0,45); break;
-                case TokenType::Number:     aColor = Color(204,102,204); break;
-                case TokenType::String:     aColor = Color(0,255,45); break;
-                case TokenType::Operator:   aColor = Color(0,0,100); break;
-                case TokenType::Keywords:   aColor = Color(0,0,255); break;
-                case TokenType::Error :     aColor = Color(0,255,255); break;
-                default:            aColor = Color(0,0,0);
-            }
-            break;
-        }
-        default: aColor = Color(0,0,0);
-
-    }
-    return aColor;
-}
-
-Color MultiLineEditSyntaxHighlight::GetColorValue(TokenType aToken)
-{
-    return GetSyntaxHighlightColor(m_aColorConfig, aHighlighter.GetLanguage(), 
aToken);
-}
-
-void MultiLineEditSyntaxHighlight::UpdateData()
-{
-    // syntax highlighting
-    // this must be possible improved by using notifychange correctly
-    bool bTempModified = GetTextEngine()->IsModified();
-    for (sal_uInt32 nLine=0; nLine < GetTextEngine()->GetParagraphCount(); 
++nLine)
-    {
-        OUString aLine( GetTextEngine()->GetText( nLine ) );
-        GetTextEngine()->RemoveAttribs( nLine );
-        std::vector<HighlightPortion> aPortions;
-        aHighlighter.getHighlightPortions( aLine, aPortions );
-        for (auto const& portion : aPortions)
-        {
-            GetTextEngine()->SetAttrib( TextAttribFontColor( 
GetColorValue(portion.tokenType) ), nLine, portion.nBegin, portion.nEnd );
-        }
-    }
-    GetTextView()->ShowCursor( false );
-    GetTextEngine()->SetModified(bTempModified);
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to