xref: /AOO41X/main/dbaccess/source/ui/inc/paramdialog.hxx (revision 2e2212a7c22e96cf6f6fab0dd042c34a45a64bd6)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _DBAUI_PARAMDIALOG_HXX_
25 #define _DBAUI_PARAMDIALOG_HXX_
26 
27 #ifndef _DBAUI_COMMON_TYPES_HXX_
28 #include "commontypes.hxx"
29 #endif
30 
31 #ifndef _DIALOG_HXX
32 #include <vcl/dialog.hxx>
33 #endif
34 #ifndef _BUTTON_HXX
35 #include <vcl/button.hxx>
36 #endif
37 #ifndef _FIXED_HXX
38 #include <vcl/fixed.hxx>
39 #endif
40 #ifndef _EDIT_HXX
41 #include <vcl/edit.hxx>
42 #endif
43 #ifndef _SV_GROUP_HXX
44 #include <vcl/group.hxx>
45 #endif
46 #ifndef _SV_LSTBOX_HXX
47 #include <vcl/lstbox.hxx>
48 #endif
49 
50 #ifndef _COM_SUN_STAR_UTIL_XNUMBERFORMATTER_HPP_
51 #include <com/sun/star/util/XNumberFormatter.hpp>
52 #endif
53 #ifndef _COM_SUN_STAR_CONTAINER_XINDEXACCESS_HPP_
54 #include <com/sun/star/container/XIndexAccess.hpp>
55 #endif
56 #ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_
57 #include <com/sun/star/sdbc/XConnection.hpp>
58 #endif
59 #ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
60 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
61 #endif
62 #ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
63 #include <com/sun/star/beans/PropertyValue.hpp>
64 #endif
65 #ifndef CONNECTIVITY_PREDICATEINPUT_HXX
66 #include <connectivity/predicateinput.hxx>
67 #endif
68 #ifndef SVX_QUERYDESIGNCONTEXT_HXX
69 #include "svx/ParseContext.hxx"
70 #endif
71 
72 namespace connectivity
73 {
74     class OSQLParseNode;
75 }
76 
77 //.........................................................................
78 namespace dbaui
79 {
80 //.........................................................................
81 
82     //==================================================================
83     //= OParameterDialog
84     //==================================================================
85     class OParameterDialog
86             :public ModalDialog
87             ,public ::svxform::OParseContextClient
88     {
89     protected:
90         // the controls
91         FixedLine       m_aNamesFrame;
92         ListBox         m_aAllParams;
93         FixedText       m_aValueFrame;
94         Edit            m_aParam;
95         PushButton      m_aTravelNext;
96         OKButton        m_aOKBtn;
97         CancelButton    m_aCancelBtn;
98 
99         sal_uInt16          m_nCurrentlySelected;
100 
101         ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >
102                         m_xParams;
103         ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >
104                         m_xConnection;
105         ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >
106                         m_xFormatter;
107         ::dbtools::OPredicateInputController
108                         m_aPredicateInput;
109 
110         ByteVector      m_aVisitedParams;
111         Timer       m_aResetVisitFlag;
112             // we reset the "visited flag" 1 second after and entry has been selected
113 
114         sal_Bool    m_bNeedErrorOnCurrent;
115 
116         ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >
117                     m_aFinalValues;     /// the final values as entered by the user
118 
119     public:
120         OParameterDialog(Window* _pParent,
121             const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > & _rParamContainer,
122             const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > & _rxConnection,
123             const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB);
124         ~OParameterDialog();
125 
126         ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >
getValues() const127                     getValues() const { return m_aFinalValues; }
128 
129 
130     protected:
131         void Construct();
132 
133         ::connectivity::OSQLParseNode* implPredicateTree(::rtl::OUString& _rErrorMessage, const UniString& _rStatement, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & _rxField);
134 
135     private:
136         DECL_LINK(OnVisitedTimeout, Timer*);
137         DECL_LINK(OnValueModified, Control*);
138         DECL_LINK(OnEntrySelected, ListBox*);
139         DECL_LINK(OnButtonClicked, PushButton*);
140         DECL_LINK(OnValueLoseFocus, Control*);
141     };
142 
143 //.........................................................................
144 }   // namespace dbaui
145 //.........................................................................
146 
147 #endif // _DBAUI_PARAMDIALOG_HXX_
148 
149