xref: /trunk/main/dbaccess/source/ui/inc/sqledit.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef DBAUI_SQLEDIT_HXX
28 #define DBAUI_SQLEDIT_HXX
29 
30 #include <svtools/editsyntaxhighlighter.hxx>
31 #include <svl/lstner.hxx>
32 #include <svtools/colorcfg.hxx>
33 #include <unotools/sourceviewconfig.hxx>
34 
35 namespace dbaui
36 {
37     class OQueryTextView;
38     class OSqlEdit : public MultiLineEditSyntaxHighlight, utl::ConfigurationListener
39     {
40     private:
41         Timer                   m_timerInvalidate;
42         Timer                   m_timerUndoActionCreation;
43         Link                    m_lnkTextModifyHdl;
44         String                  m_strOrigText;      // wird beim Undo wiederhergestellt
45         OQueryTextView*         m_pView;
46         sal_Bool                    m_bAccelAction;     // Wird bei Cut, Copy, Paste gesetzt
47         sal_Bool                    m_bStopTimer;
48         utl::SourceViewConfig   m_SourceViewConfig;
49         svtools::ColorConfig    m_ColorConfig;
50 
51         DECL_LINK(OnUndoActionTimer, void*);
52         DECL_LINK(OnInvalidateTimer, void*);
53 
54     private:
55         void            ImplSetFont();
56 
57     protected:
58         virtual void KeyInput( const KeyEvent& rKEvt );
59         virtual void GetFocus();
60 
61         DECL_LINK(ModifyHdl, void*);
62 
63     public:
64         OSqlEdit( OQueryTextView* pParent,  WinBits nWinStyle = WB_LEFT | WB_VSCROLL |WB_BORDER);
65         virtual ~OSqlEdit();
66 
67         // Edit overridables
68         virtual void SetText(const String& rNewText);
69         using MultiLineEditSyntaxHighlight::SetText;
70 
71         // own functionality
72         sal_Bool IsInAccelAct();
73 
74         void SetTextModifyHdl(const Link& lnk) { m_lnkTextModifyHdl = lnk; }
75             // bitte nicht SetModifyHdl benutzen, den brauche ich selber, der hier wird von dem damit gesetzten Handler
76             // gerufen
77             // der Link bekommt einen Pointer-to-string, der nach dem Link nicht mehr gueltig ist
78 
79         void stopTimer();
80         void startTimer();
81 
82         virtual void    ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 );
83         using MultiLineEditSyntaxHighlight::Notify;
84     };
85 }
86 
87 #endif // DBAUI_SQLEDIT_HXX
88 
89 
90