merge the formfield patch from ooo-build
[ooovba.git] / dbaccess / source / ui / inc / queryfilter.hxx
blobaa16b97c613d07bf30c4c51c0e4537dab07e8dfd
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: queryfilter.hxx,v $
10 * $Revision: 1.15 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef DBAUI_QUERYFILTER_HXX
32 #define DBAUI_QUERYFILTER_HXX
34 #ifndef _DIALOG_HXX //autogen
35 #include <vcl/dialog.hxx>
36 #endif
38 #ifndef _LSTBOX_HXX //autogen
39 #include <vcl/lstbox.hxx>
40 #endif
42 #ifndef _EDIT_HXX //autogen
43 #include <vcl/edit.hxx>
44 #endif
46 #ifndef _FIXED_HXX //autogen
47 #include <vcl/fixed.hxx>
48 #endif
50 #ifndef _BUTTON_HXX //autogen
51 #include <vcl/button.hxx>
52 #endif
53 #ifndef _CONNECTIVITY_PARSE_SQLITERATOR_HXX_
54 #include <connectivity/sqliterator.hxx>
55 #endif
57 #ifndef CONNECTIVITY_PREDICATEINPUT_HXX
58 #include <connectivity/predicateinput.hxx>
59 #endif
60 #ifndef SVX_QUERYDESIGNCONTEXT_HXX
61 #include "svx/ParseContext.hxx"
62 #endif
64 namespace rtl
66 class OUString;
68 namespace com
70 namespace sun
72 namespace star
74 namespace sdb
76 class XSingleSelectQueryComposer;
78 namespace sdbc
80 class XConnection;
81 class XDatabaseMetaData;
83 namespace container
85 class XNameAccess;
87 namespace beans
89 struct PropertyValue;
94 //==================================================================
95 // DlgFilterCrit
96 //==================================================================
97 namespace dbaui
99 class DlgFilterCrit :public ModalDialog
100 ,public ::svxform::OParseContextClient
102 private:
103 ListBox aLB_WHEREFIELD1;
104 ListBox aLB_WHERECOMP1;
105 Edit aET_WHEREVALUE1;
106 ListBox aLB_WHERECOND2;
107 ListBox aLB_WHEREFIELD2;
108 ListBox aLB_WHERECOMP2;
109 Edit aET_WHEREVALUE2;
110 ListBox aLB_WHERECOND3;
111 ListBox aLB_WHEREFIELD3;
112 ListBox aLB_WHERECOMP3;
113 Edit aET_WHEREVALUE3;
114 FixedText aFT_WHEREFIELD;
115 FixedText aFT_WHERECOMP;
116 FixedText aFT_WHEREVALUE;
117 FixedText aFT_WHEREOPER;
118 FixedLine aFL_FIELDS;
119 OKButton aBT_OK;
120 CancelButton aBT_CANCEL;
121 HelpButton aBT_HELP;
122 String aSTR_NOENTRY;
123 String aSTR_COMPARE_OPERATORS;
125 ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryComposer> m_xQueryComposer;
126 ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> m_xColumns;
127 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> m_xConnection;
128 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData> m_xMetaData;
130 ::dbtools::OPredicateInputController m_aPredicateInput;
132 void SelectField( ListBox& rBox, const String& rField );
133 DECL_LINK( ListSelectHdl, ListBox * );
134 DECL_LINK( ListSelectCompHdl, ListBox * );
136 void SetLine( USHORT nIdx,const ::com::sun::star::beans::PropertyValue& _rItem,sal_Bool _bOr );
137 void EnableLines();
138 sal_Int32 GetOSQLPredicateType( const String& _rSelectedPredicate ) const;
139 USHORT GetSelectionPos(sal_Int32 eType,const ListBox& rListBox) const;
140 sal_Bool getCondition(const ListBox& _rField,const ListBox& _rComp,const Edit& _rValue,::com::sun::star::beans::PropertyValue& _rFilter) const;
141 void fillLines(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > >& _aValues);
143 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > getMatchingColumn( const Edit& _rValueInput ) const;
144 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > getColumn( const ::rtl::OUString& _rFieldName ) const;
145 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > getQueryColumn( const ::rtl::OUString& _rFieldName ) const;
147 public:
148 DlgFilterCrit( Window * pParent,
149 const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB,
150 const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _rxConnection,
151 const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryComposer>& _rxComposer,
152 const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess>& _rxCols
154 ~DlgFilterCrit();
156 void BuildWherePart();
158 protected:
159 DECL_LINK( PredicateLoseFocus, Edit* );
164 #endif // DBAUI_QUERYFILTER_HXX