summaryrefslogtreecommitdiff
path: root/dbaccess
diff options
context:
space:
mode:
authorRelease Engineers <releng@openoffice.org>2008-11-28 11:39:37 +0000
committerRelease Engineers <releng@openoffice.org>2008-11-28 11:39:37 +0000
commitf2c90bcc552da21d692df2abeaf3997f8a7eda78 (patch)
tree236bd738e41663d1ab7bdb2982fa0a5c7989bcf0 /dbaccess
parenta434aa0492f90af256a0f2460a205520d09d1a56 (diff)
CWS-TOOLING: integrate CWS sqlsyntaxhighlighting
2008-11-20 17:23:29 +0100 mod r264074 : new colors by UX 2008-11-17 17:37:19 +0100 mod r263732 : revert manual fix for icu 2008-11-17 15:03:39 +0100 mod r263725 : manual fix for icu 2008-11-17 11:26:39 +0100 mod r263709 : manual fix for icu 2008-11-16 18:19:16 +0100 mod r263702 : `fix 2008-11-12 22:11:50 +0100 mod r263619 : CWS-TOOLING: rebase CWS sqlsyntaxhighlighting to trunk@263288 (milestone: DEV300:m35) 2008-11-12 11:04:33 +0100 mod r263578 : minor cleanup 2008-11-12 11:03:02 +0100 mod r263577 : seperate MulitLineEditSyntaxHighlighter into new file 2008-11-06 15:13:27 +0100 fs r263391 : merged from trunk 2008-11-06 15:09:20 +0100 fs r263390 : merged from trunk 2008-11-06 15:07:06 +0100 fs r263388 : reverted the change c262599. This seems to be a merge from trunk, but without properly setting svn:mergeinfo, thus it results in conflicts when doing a real 'svn merge'. 2008-11-06 15:03:19 +0100 fs r263387 : merged rev. 262769 2008-11-03 17:58:19 +0100 mod r263297 : little fixes 2008-11-03 17:56:49 +0100 mod r263296 : little fixes 2008-11-03 17:12:41 +0100 mod r263295 : new entry SQL comment for Tools-Appearance 2008-11-03 17:12:13 +0100 mod r263294 : different tokenizer based on language 2008-11-03 17:11:40 +0100 mod r263293 : new entry for Tools-Appearance: SQL Comment 2008-11-03 17:11:14 +0100 mod r263292 : get notification about color changes for sql view 2008-10-29 00:01:40 +0100 mod r262768 : string listbox 2008-10-28 23:57:45 +0100 mod r262767 : string listbox 2008-10-22 18:38:07 +0200 mod r262614 : source alignment fix 2008-10-22 18:37:23 +0200 mod r262613 : '' as string as well 2008-10-22 18:36:45 +0200 mod r262612 : get syntax highlighting in tools-sql... 2008-10-22 14:11:12 +0200 mod r262605 : formatting fix 2008-10-22 13:30:42 +0200 mod r262599 : additional entries for Tools-Options-Appearance 2008-10-19 22:53:50 +0200 mod r262302 : migration from cvs to svn 2008-10-19 22:37:45 +0200 mod r262301 : migration from cvs to svn 2008-10-19 22:36:04 +0200 mod r262300 : migration from cvs to svn
Diffstat (limited to 'dbaccess')
-rw-r--r--dbaccess/source/ui/control/sqledit.cxx60
-rw-r--r--dbaccess/source/ui/inc/directsql.hxx4
-rw-r--r--dbaccess/source/ui/inc/sqledit.hxx175
3 files changed, 133 insertions, 106 deletions
diff --git a/dbaccess/source/ui/control/sqledit.cxx b/dbaccess/source/ui/control/sqledit.cxx
index 4f42023f8161..b12f30cf1916 100644
--- a/dbaccess/source/ui/control/sqledit.cxx
+++ b/dbaccess/source/ui/control/sqledit.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: sqledit.cxx,v $
- * $Revision: 1.12 $
+ * $Revision: 1.12.16.3 $
*
* This file is part of OpenOffice.org.
*
@@ -30,31 +30,18 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_dbaccess.hxx"
-#ifndef DBAUI_SQLEDIT_HXX
#include "sqledit.hxx"
-#endif
-#ifndef DBAUI_QUERYVIEW_TEXT_HXX
#include "QueryTextView.hxx"
-#endif
-#ifndef DBAUI_QUERYCONTAINERWINDOW_HXX
#include "querycontainerwindow.hxx"
-#endif
-#ifndef _TOOLS_DEBUG_HXX
#include <tools/debug.hxx>
-#endif
#include "dbaccess_helpid.hrc"
-#ifndef DBACCESS_UI_BROWSER_ID_HXX
#include "browserids.hxx"
-#endif
-#ifndef DBAUI_QUERYCONTROLLER_HXX
#include "querycontroller.hxx"
-#endif
-#ifndef DBAUI_UNDOSQLEDIT_HXX
#include "undosqledit.hxx"
-#endif
-#ifndef DBAUI_QUERYDESIGNVIEW_HXX
#include "QueryDesignView.hxx"
-#endif
+
+#include <svtools/smplhint.hxx>
+
//////////////////////////////////////////////////////////////////////////
// OSqlEdit
//------------------------------------------------------------------------------
@@ -62,7 +49,7 @@ using namespace dbaui;
DBG_NAME(OSqlEdit)
OSqlEdit::OSqlEdit( OQueryTextView* pParent, WinBits nWinStyle ) :
- MultiLineEdit( pParent, nWinStyle )
+ MultiLineEditSyntaxHighlight( pParent, nWinStyle )
,m_pView(pParent)
,m_bAccelAction( sal_False )
,m_bStopTimer(sal_False )
@@ -77,6 +64,11 @@ OSqlEdit::OSqlEdit( OQueryTextView* pParent, WinBits nWinStyle ) :
m_timerInvalidate.SetTimeout(200);
m_timerInvalidate.SetTimeoutHdl(LINK(this, OSqlEdit, OnInvalidateTimer));
m_timerInvalidate.Start();
+
+ ImplSetFont();
+ // listen for change of Font Setting
+ StartListening(m_SourceViewConfig);
+ StartListening(m_ColorConfig);
}
//------------------------------------------------------------------------------
@@ -85,6 +77,8 @@ OSqlEdit::~OSqlEdit()
DBG_DTOR(OSqlEdit,NULL);
if (m_timerUndoActionCreation.IsActive())
m_timerUndoActionCreation.Stop();
+ EndListening(m_SourceViewConfig);
+ EndListening(m_ColorConfig);
}
//------------------------------------------------------------------------------
void OSqlEdit::KeyInput( const KeyEvent& rKEvt )
@@ -98,7 +92,7 @@ void OSqlEdit::KeyInput( const KeyEvent& rKEvt )
if( (aKeyFunc==KEYFUNC_CUT)||(aKeyFunc==KEYFUNC_COPY)||(aKeyFunc==KEYFUNC_PASTE) )
m_bAccelAction = sal_True;
- MultiLineEdit::KeyInput( rKEvt );
+ MultiLineEditSyntaxHighlight::KeyInput( rKEvt );
if( m_bAccelAction )
m_bAccelAction = sal_False;
@@ -121,7 +115,7 @@ void OSqlEdit::GetFocus()
{
DBG_CHKTHIS(OSqlEdit,NULL);
m_strOrigText =GetText();
- MultiLineEdit::GetFocus();
+ MultiLineEditSyntaxHighlight::GetFocus();
}
//------------------------------------------------------------------------------
@@ -181,7 +175,7 @@ void OSqlEdit::SetText(const String& rNewText)
LINK(this, OSqlEdit, OnUndoActionTimer).Call(NULL);
}
- MultiLineEdit::SetText(rNewText);
+ MultiLineEditSyntaxHighlight::SetText(rNewText);
m_strOrigText =rNewText;
}
// -----------------------------------------------------------------------------
@@ -199,4 +193,28 @@ void OSqlEdit::startTimer()
m_timerInvalidate.Start();
}
+void OSqlEdit::Notify( SfxBroadcaster& rBC, const SfxHint& /*rHint*/ )
+{
+ if (&rBC == &m_SourceViewConfig)
+ ImplSetFont();
+ else if (&rBC == &m_ColorConfig)
+ MultiLineEditSyntaxHighlight::UpdateData();
+}
+
+void OSqlEdit::ImplSetFont()
+{
+ AllSettings aSettings = GetSettings();
+ StyleSettings aStyleSettings = aSettings.GetStyleSettings();
+ String sFontName = m_SourceViewConfig.GetFontName();
+ if ( !sFontName.Len() )
+ {
+ Font aTmpFont( OutputDevice::GetDefaultFont( DEFAULTFONT_FIXED, Application::GetSettings().GetUILanguage(), 0 , this ) );
+ sFontName = aTmpFont.GetName();
+ }
+ Size aFontSize( 0, m_SourceViewConfig.GetFontHeight() );
+ Font aFont( sFontName, aFontSize );
+ aStyleSettings.SetFieldFont(aFont);
+ aSettings.SetStyleSettings(aStyleSettings);
+ SetSettings(aSettings);
+}
//==============================================================================
diff --git a/dbaccess/source/ui/inc/directsql.hxx b/dbaccess/source/ui/inc/directsql.hxx
index 7ecaf397b128..a6574a26f1f9 100644
--- a/dbaccess/source/ui/inc/directsql.hxx
+++ b/dbaccess/source/ui/inc/directsql.hxx
@@ -35,7 +35,7 @@
#include <vcl/dialog.hxx>
#endif
#ifndef _SVEDIT_HXX
-#include <svtools/svmedit.hxx>
+#include <svtools/editsyntaxhighlighter.hxx>
#endif
#ifndef _SV_FIXED_HXX
#include <vcl/fixed.hxx>
@@ -82,7 +82,7 @@ namespace dbaui
FixedLine m_aFrame;
FixedText m_aSQLLabel;
- MultiLineEdit m_aSQL;
+ MultiLineEditSyntaxHighlight m_aSQL;
PushButton m_aExecute;
FixedText m_aHistoryLabel;
ListBox* m_pSQLHistory;
diff --git a/dbaccess/source/ui/inc/sqledit.hxx b/dbaccess/source/ui/inc/sqledit.hxx
index f3f08b629f4f..1de6f785f54a 100644
--- a/dbaccess/source/ui/inc/sqledit.hxx
+++ b/dbaccess/source/ui/inc/sqledit.hxx
@@ -1,83 +1,92 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: sqledit.hxx,v $
- * $Revision: 1.5 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef DBAUI_SQLEDIT_HXX
-#define DBAUI_SQLEDIT_HXX
-
-#ifndef _SVEDIT_HXX
-#include <svtools/svmedit.hxx>
-#endif
-
-namespace dbaui
-{
- class OQueryTextView;
- class OSqlEdit : public MultiLineEdit
- {
- private:
- Timer m_timerInvalidate;
- Timer m_timerUndoActionCreation;
- Link m_lnkTextModifyHdl;
- String m_strOrigText; // wird beim Undo wiederhergestellt
- OQueryTextView* m_pView;
- BOOL m_bAccelAction; // Wird bei Cut, Copy, Paste gesetzt
- BOOL m_bStopTimer;
-
- DECL_LINK(OnUndoActionTimer, void*);
- DECL_LINK(OnInvalidateTimer, void*);
-
- protected:
- virtual void KeyInput( const KeyEvent& rKEvt );
- virtual void GetFocus();
-
- DECL_LINK(ModifyHdl, void*);
-
- public:
- OSqlEdit( OQueryTextView* pParent, WinBits nWinStyle = WB_LEFT | WB_VSCROLL |WB_BORDER);
- virtual ~OSqlEdit();
-
- // Edit overridables
- virtual void SetText(const String& rNewText);
- using MultiLineEdit::SetText;
-
- // own functionality
- BOOL IsInAccelAct();
-
- void SetTextModifyHdl(const Link& lnk) { m_lnkTextModifyHdl = lnk; }
- // bitte nicht SetModifyHdl benutzen, den brauche ich selber, der hier wird von dem damit gesetzten Handler
- // gerufen
- // der Link bekommt einen Pointer-to-string, der nach dem Link nicht mehr gueltig ist
-
- void stopTimer();
- void startTimer();
- };
-}
-
-#endif // DBAUI_SQLEDIT_HXX
-
-
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: sqledit.hxx,v $
+ * $Revision: 1.5.60.2 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef DBAUI_SQLEDIT_HXX
+#define DBAUI_SQLEDIT_HXX
+
+#include <svtools/editsyntaxhighlighter.hxx>
+#include <svtools/lstner.hxx>
+#include <svtools/colorcfg.hxx>
+#include <svtools/sourceviewconfig.hxx>
+
+namespace dbaui
+{
+ class OQueryTextView;
+ class OSqlEdit : public MultiLineEditSyntaxHighlight, SfxListener
+ {
+ private:
+ Timer m_timerInvalidate;
+ Timer m_timerUndoActionCreation;
+ Link m_lnkTextModifyHdl;
+ String m_strOrigText; // wird beim Undo wiederhergestellt
+ OQueryTextView* m_pView;
+ BOOL m_bAccelAction; // Wird bei Cut, Copy, Paste gesetzt
+ BOOL m_bStopTimer;
+ svt::SourceViewConfig m_SourceViewConfig;
+ svtools::ColorConfig m_ColorConfig;
+
+ DECL_LINK(OnUndoActionTimer, void*);
+ DECL_LINK(OnInvalidateTimer, void*);
+
+ private:
+ void ImplSetFont();
+
+ protected:
+ virtual void KeyInput( const KeyEvent& rKEvt );
+ virtual void GetFocus();
+
+ DECL_LINK(ModifyHdl, void*);
+
+ public:
+ OSqlEdit( OQueryTextView* pParent, WinBits nWinStyle = WB_LEFT | WB_VSCROLL |WB_BORDER);
+ virtual ~OSqlEdit();
+
+ // Edit overridables
+ virtual void SetText(const String& rNewText);
+ using MultiLineEditSyntaxHighlight::SetText;
+
+ // own functionality
+ BOOL IsInAccelAct();
+
+ void SetTextModifyHdl(const Link& lnk) { m_lnkTextModifyHdl = lnk; }
+ // bitte nicht SetModifyHdl benutzen, den brauche ich selber, der hier wird von dem damit gesetzten Handler
+ // gerufen
+ // der Link bekommt einen Pointer-to-string, der nach dem Link nicht mehr gueltig ist
+
+ void stopTimer();
+ void startTimer();
+
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+ using MultiLineEditSyntaxHighlight::Notify;
+ };
+}
+
+#endif // DBAUI_SQLEDIT_HXX
+
+