tdf#130857 qt weld: Implement QtInstanceWidget::get_text_height
[LibreOffice.git] / dbaccess / source / ui / inc / queryfilter.hxx
blob396778f22997ac5c7629788a69c97e9cbecb6b40
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 #pragma once
22 #include <vcl/weld.hxx>
23 #include <connectivity/sqliterator.hxx>
25 #include <connectivity/predicateinput.hxx>
26 #include <svx/ParseContext.hxx>
28 namespace com::sun::star {
29 namespace sdb
31 class XSingleSelectQueryComposer;
33 namespace sdbc
35 class XConnection;
36 class XDatabaseMetaData;
38 namespace container
40 class XNameAccess;
42 namespace beans
44 struct PropertyValue;
48 // DlgFilterCrit
49 namespace dbaui
51 class DlgFilterCrit final : public weld::GenericDialogController
52 , public ::svxform::OParseContextClient
54 private:
55 std::vector<OUString> m_aSTR_COMPARE_OPERATORS;
57 css::uno::Reference< css::sdb::XSingleSelectQueryComposer> m_xQueryComposer;
58 css::uno::Reference< css::container::XNameAccess> m_xColumns;
59 css::uno::Reference< css::sdbc::XConnection> m_xConnection;
60 css::uno::Reference< css::sdbc::XDatabaseMetaData> m_xMetaData;
62 ::dbtools::OPredicateInputController m_aPredicateInput;
64 std::unique_ptr<weld::ComboBox> m_xLB_WHEREFIELD1;
65 std::unique_ptr<weld::ComboBox> m_xLB_WHERECOMP1;
66 std::unique_ptr<weld::Entry> m_xET_WHEREVALUE1;
68 std::unique_ptr<weld::ComboBox> m_xLB_WHERECOND2;
69 std::unique_ptr<weld::ComboBox> m_xLB_WHEREFIELD2;
70 std::unique_ptr<weld::ComboBox> m_xLB_WHERECOMP2;
71 std::unique_ptr<weld::Entry> m_xET_WHEREVALUE2;
73 std::unique_ptr<weld::ComboBox> m_xLB_WHERECOND3;
74 std::unique_ptr<weld::ComboBox> m_xLB_WHEREFIELD3;
75 std::unique_ptr<weld::ComboBox> m_xLB_WHERECOMP3;
76 std::unique_ptr<weld::Entry> m_xET_WHEREVALUE3;
78 static void SelectField(weld::ComboBox& rBox, std::u16string_view rField);
79 DECL_LINK(ListSelectHdl, weld::ComboBox&, void);
80 DECL_LINK(ListSelectCompHdl, weld::ComboBox&, void);
82 void SetLine( int nIdx, const css::beans::PropertyValue& _rItem, bool _bOr );
83 void EnableLines();
84 sal_Int32 GetOSQLPredicateType( std::u16string_view _rSelectedPredicate ) const;
85 static sal_Int32 GetSelectionPos(sal_Int32 eType, const weld::ComboBox& rListBox);
86 bool getCondition(const weld::ComboBox& _rField, const weld::ComboBox& _rComp, const weld::Entry& _rValue, css::beans::PropertyValue& _rFilter) const;
87 void fillLines(int &i, const css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > >& _aValues);
89 css::uno::Reference< css::beans::XPropertySet > getMatchingColumn( const weld::Entry& _rValueInput ) const;
90 css::uno::Reference< css::beans::XPropertySet > getColumn( const OUString& _rFieldName ) const;
91 css::uno::Reference< css::beans::XPropertySet > getQueryColumn( const OUString& _rFieldName ) const;
93 public:
94 DlgFilterCrit(weld::Window * pParent,
95 const css::uno::Reference< css::uno::XComponentContext >& rxContext,
96 const css::uno::Reference< css::sdbc::XConnection>& _rxConnection,
97 const css::uno::Reference< css::sdb::XSingleSelectQueryComposer>& _rxComposer,
98 const css::uno::Reference< css::container::XNameAccess>& _rxCols);
99 virtual ~DlgFilterCrit() override;
101 void BuildWherePart();
103 private:
104 DECL_LINK(PredicateLoseFocus, weld::Widget&, void);
109 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */