Version 5.2.6.1, tag libreoffice-5.2.6.1
[LibreOffice.git] / dbaccess / source / ui / inc / queryfilter.hxx
blob1b7a2ed960b1045bd919707760d2d45b13b60f7e
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_QUERYFILTER_HXX
21 #define INCLUDED_DBACCESS_SOURCE_UI_INC_QUERYFILTER_HXX
23 #include <vcl/dialog.hxx>
25 #include <vcl/lstbox.hxx>
27 #include <vcl/edit.hxx>
29 #include <vcl/fixed.hxx>
31 #include <vcl/button.hxx>
32 #include <connectivity/sqliterator.hxx>
34 #include <connectivity/predicateinput.hxx>
35 #include "svx/ParseContext.hxx"
37 namespace com
39 namespace sun
41 namespace star
43 namespace sdb
45 class XSingleSelectQueryComposer;
47 namespace sdbc
49 class XConnection;
50 class XDatabaseMetaData;
52 namespace container
54 class XNameAccess;
56 namespace beans
58 struct PropertyValue;
63 // DlgFilterCrit
64 namespace dbaui
66 class DlgFilterCrit :public ModalDialog
67 ,public ::svxform::OParseContextClient
69 private:
70 VclPtr<ListBox> m_pLB_WHEREFIELD1;
71 VclPtr<ListBox> m_pLB_WHERECOMP1;
72 VclPtr<Edit> m_pET_WHEREVALUE1;
74 VclPtr<ListBox> m_pLB_WHERECOND2;
75 VclPtr<ListBox> m_pLB_WHEREFIELD2;
76 VclPtr<ListBox> m_pLB_WHERECOMP2;
77 VclPtr<Edit> m_pET_WHEREVALUE2;
79 VclPtr<ListBox> m_pLB_WHERECOND3;
80 VclPtr<ListBox> m_pLB_WHEREFIELD3;
81 VclPtr<ListBox> m_pLB_WHERECOMP3;
82 VclPtr<Edit> m_pET_WHEREVALUE3;
84 OUString m_aSTR_COMPARE_OPERATORS;
86 css::uno::Reference< css::sdb::XSingleSelectQueryComposer> m_xQueryComposer;
87 css::uno::Reference< css::container::XNameAccess> m_xColumns;
88 css::uno::Reference< css::sdbc::XConnection> m_xConnection;
89 css::uno::Reference< css::sdbc::XDatabaseMetaData> m_xMetaData;
91 ::dbtools::OPredicateInputController m_aPredicateInput;
93 static void SelectField( ListBox& rBox, const OUString& rField );
94 DECL_LINK_TYPED( ListSelectHdl, ListBox&, void );
95 DECL_LINK_TYPED( ListSelectCompHdl, ListBox&, void );
97 void SetLine( sal_uInt16 nIdx,const css::beans::PropertyValue& _rItem,bool _bOr );
98 void EnableLines();
99 sal_Int32 GetOSQLPredicateType( const OUString& _rSelectedPredicate ) const;
100 static sal_Int32 GetSelectionPos(sal_Int32 eType,const ListBox& rListBox);
101 bool getCondition(const ListBox& _rField,const ListBox& _rComp,const Edit& _rValue,css::beans::PropertyValue& _rFilter) const;
102 void fillLines(const css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > >& _aValues);
104 css::uno::Reference< css::beans::XPropertySet > getMatchingColumn( const Edit& _rValueInput ) const;
105 css::uno::Reference< css::beans::XPropertySet > getColumn( const OUString& _rFieldName ) const;
106 css::uno::Reference< css::beans::XPropertySet > getQueryColumn( const OUString& _rFieldName ) const;
108 public:
109 DlgFilterCrit( vcl::Window * pParent,
110 const css::uno::Reference< css::uno::XComponentContext >& rxContext,
111 const css::uno::Reference< css::sdbc::XConnection>& _rxConnection,
112 const css::uno::Reference< css::sdb::XSingleSelectQueryComposer>& _rxComposer,
113 const css::uno::Reference< css::container::XNameAccess>& _rxCols
115 virtual ~DlgFilterCrit();
116 virtual void dispose() override;
118 void BuildWherePart();
120 protected:
121 DECL_LINK_TYPED( PredicateLoseFocus, Control&, void );
126 #endif // INCLUDED_DBACCESS_SOURCE_UI_INC_QUERYFILTER_HXX
128 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */