xref: /trunk/main/dbaccess/source/ui/inc/paramdialog.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 
28 #ifndef _DBAUI_PARAMDIALOG_HXX_
29 #define _DBAUI_PARAMDIALOG_HXX_
30 
31 #ifndef _DBAUI_COMMON_TYPES_HXX_
32 #include "commontypes.hxx"
33 #endif
34 
35 #ifndef _DIALOG_HXX
36 #include <vcl/dialog.hxx>
37 #endif
38 #ifndef _BUTTON_HXX
39 #include <vcl/button.hxx>
40 #endif
41 #ifndef _FIXED_HXX
42 #include <vcl/fixed.hxx>
43 #endif
44 #ifndef _EDIT_HXX
45 #include <vcl/edit.hxx>
46 #endif
47 #ifndef _SV_GROUP_HXX
48 #include <vcl/group.hxx>
49 #endif
50 #ifndef _SV_LSTBOX_HXX
51 #include <vcl/lstbox.hxx>
52 #endif
53 
54 #ifndef _COM_SUN_STAR_UTIL_XNUMBERFORMATTER_HPP_
55 #include <com/sun/star/util/XNumberFormatter.hpp>
56 #endif
57 #ifndef _COM_SUN_STAR_CONTAINER_XINDEXACCESS_HPP_
58 #include <com/sun/star/container/XIndexAccess.hpp>
59 #endif
60 #ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_
61 #include <com/sun/star/sdbc/XConnection.hpp>
62 #endif
63 #ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
64 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
65 #endif
66 #ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
67 #include <com/sun/star/beans/PropertyValue.hpp>
68 #endif
69 #ifndef CONNECTIVITY_PREDICATEINPUT_HXX
70 #include <connectivity/predicateinput.hxx>
71 #endif
72 #ifndef SVX_QUERYDESIGNCONTEXT_HXX
73 #include "svx/ParseContext.hxx"
74 #endif
75 
76 namespace connectivity
77 {
78     class OSQLParseNode;
79 }
80 
81 //.........................................................................
82 namespace dbaui
83 {
84 //.........................................................................
85 
86     //==================================================================
87     //= OParameterDialog
88     //==================================================================
89     class OParameterDialog
90             :public ModalDialog
91             ,public ::svxform::OParseContextClient
92     {
93     protected:
94         // the controls
95         FixedLine       m_aNamesFrame;
96         ListBox         m_aAllParams;
97         FixedText       m_aValueFrame;
98         Edit            m_aParam;
99         PushButton      m_aTravelNext;
100         OKButton        m_aOKBtn;
101         CancelButton    m_aCancelBtn;
102 
103         sal_uInt16          m_nCurrentlySelected;
104 
105         ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >
106                         m_xParams;
107         ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >
108                         m_xConnection;
109         ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >
110                         m_xFormatter;
111         ::dbtools::OPredicateInputController
112                         m_aPredicateInput;
113 
114         ByteVector      m_aVisitedParams;
115         Timer       m_aResetVisitFlag;
116             // we reset the "visited flag" 1 second after and entry has been selected
117 
118         sal_Bool    m_bNeedErrorOnCurrent;
119 
120         ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >
121                     m_aFinalValues;     /// the final values as entered by the user
122 
123     public:
124         OParameterDialog(Window* _pParent,
125             const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > & _rParamContainer,
126             const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > & _rxConnection,
127             const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB);
128         ~OParameterDialog();
129 
130         ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >
131                     getValues() const { return m_aFinalValues; }
132 
133 
134     protected:
135         void Construct();
136 
137         ::connectivity::OSQLParseNode* implPredicateTree(::rtl::OUString& _rErrorMessage, const UniString& _rStatement, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & _rxField);
138 
139     private:
140         DECL_LINK(OnVisitedTimeout, Timer*);
141         DECL_LINK(OnValueModified, Control*);
142         DECL_LINK(OnEntrySelected, ListBox*);
143         DECL_LINK(OnButtonClicked, PushButton*);
144         DECL_LINK(OnValueLoseFocus, Control*);
145     };
146 
147 //.........................................................................
148 }   // namespace dbaui
149 //.........................................................................
150 
151 #endif // _DBAUI_PARAMDIALOG_HXX_
152 
153