summaryrefslogtreecommitdiff
path: root/dbaccess
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-05-13 13:59:11 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-05-20 20:24:16 +0200
commit68d161c6803654f4ce816af7e79371a2d3497b4f (patch)
tree97cc8e55906b91ac966d7b1c09bdfcf51e8480f9 /dbaccess
parent96536d92e8026cebfde11e5539ee90471d0e7933 (diff)
weld ComboBoxControl
Change-Id: Ie862bb782b4c3e203af88d45c850ce0cab60f2e5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94123 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'dbaccess')
-rw-r--r--dbaccess/source/ui/inc/QueryDesignView.hxx8
-rw-r--r--dbaccess/source/ui/querydesign/QueryDesignView.cxx10
-rw-r--r--dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx45
3 files changed, 38 insertions, 25 deletions
diff --git a/dbaccess/source/ui/inc/QueryDesignView.hxx b/dbaccess/source/ui/inc/QueryDesignView.hxx
index feb1266b24fb..4f057178669c 100644
--- a/dbaccess/source/ui/inc/QueryDesignView.hxx
+++ b/dbaccess/source/ui/inc/QueryDesignView.hxx
@@ -28,8 +28,10 @@ namespace connectivity
{
class OSQLParseNode;
}
-
-class ComboBox;
+namespace weld
+{
+ class ComboBox;
+}
namespace dbaui
{
enum SqlParseError
@@ -109,7 +111,7 @@ namespace dbaui
void TableDeleted(const OUString& rAliasName);
sal_Int32 getColWidth( sal_uInt16 _nColPos) const;
- void fillValidFields(const OUString& strTableName, ComboBox* pFieldList);
+ void fillValidFields(const OUString& strTableName, weld::ComboBox& rFieldList);
void SaveUIConfig();
void stopTimer();
diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
index 59494bc9b253..30afb75932f6 100644
--- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
@@ -27,7 +27,6 @@
#include <o3tl/safeint.hxx>
#include <osl/diagnose.h>
#include <vcl/svapp.hxx>
-#include <vcl/combobox.hxx>
#include <vcl/weld.hxx>
#include <browserids.hxx>
#include "SelectionBrowseBox.hxx"
@@ -2647,10 +2646,9 @@ sal_Int32 OQueryDesignView::getColWidth(sal_uInt16 _nColPos) const
return nWidth;
}
-void OQueryDesignView::fillValidFields(const OUString& sAliasName, ComboBox* pFieldList)
+void OQueryDesignView::fillValidFields(const OUString& sAliasName, weld::ComboBox& rFieldList)
{
- OSL_ENSURE(pFieldList != nullptr, "OQueryDesignView::FillValidFields : What the hell do you think I can do with a NULL-ptr ? This will crash !");
- pFieldList->Clear();
+ rFieldList.clear();
bool bAllTables = sAliasName.isEmpty();
@@ -2669,9 +2667,9 @@ void OQueryDesignView::fillValidFields(const OUString& sAliasName, ComboBox* pFi
for (auto const& field : aFields)
{
if (bAllTables || field.toChar() == '*')
- pFieldList->InsertEntry(strCurrentPrefix + field);
+ rFieldList.append_text(strCurrentPrefix + field);
else
- pFieldList->InsertEntry(field);
+ rFieldList.append_text(field);
}
if (!bAllTables)
diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
index a288e478bc14..c2b4cd9517d8 100644
--- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
+++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
@@ -122,7 +122,7 @@ OSelectionBrowseBox::OSelectionBrowseBox( vcl::Window* pParent )
m_pTextCell = VclPtr<Edit>::Create(&GetDataWindow(), 0);
m_pVisibleCell = VclPtr<CheckBoxControl>::Create(&GetDataWindow());
m_pTableCell = VclPtr<ListBoxControl>::Create(&GetDataWindow()); m_pTableCell->SetDropDownLineCount( 20 );
- m_pFieldCell = VclPtr<ComboBoxControl>::Create(&GetDataWindow()); m_pFieldCell->SetDropDownLineCount( 20 );
+ m_pFieldCell = VclPtr<ComboBoxControl>::Create(&GetDataWindow());
m_pOrderCell = VclPtr<ListBoxControl>::Create(&GetDataWindow());
m_pFunctionCell = VclPtr<ListBoxControl>::Create(&GetDataWindow()); m_pFunctionCell->SetDropDownLineCount( 20 );
@@ -475,20 +475,21 @@ void OSelectionBrowseBox::InitController(CellControllerRef& /*rController*/, lon
{
case BROW_FIELD_ROW:
{
- m_pFieldCell->Clear();
- m_pFieldCell->SetText(OUString());
+ weld::ComboBox& rComboBox = m_pFieldCell->get_widget();
+ rComboBox.clear();
+ rComboBox.set_entry_text(OUString());
OUString aField(pEntry->GetField());
OUString aTable(pEntry->GetAlias());
- getDesignView()->fillValidFields(aTable, m_pFieldCell);
+ getDesignView()->fillValidFields(aTable, rComboBox);
// replace with alias.*
if (aField.trim() == "*")
{
aField = aTable + ".*";
}
- m_pFieldCell->SetText(aField);
+ rComboBox.set_entry_text(aField);
} break;
case BROW_TABLE_ROW:
{
@@ -924,7 +925,8 @@ bool OSelectionBrowseBox::SaveModified()
case BROW_FIELD_ROW:
{
- OUString aFieldName(m_pFieldCell->GetText());
+ weld::ComboBox& rComboBox = m_pFieldCell->get_widget();
+ OUString aFieldName(rComboBox.get_active_text());
try
{
if (aFieldName.isEmpty())
@@ -943,9 +945,9 @@ bool OSelectionBrowseBox::SaveModified()
if ( !m_bInUndoMode )
rController.GetUndoManager().EnterListAction(OUString(),OUString(),0,ViewShellId(-1));
- sal_Int32 nPos = m_pFieldCell->GetEntryPos(aFieldName);
+ sal_Int32 nPos = rComboBox.find_text(aFieldName);
OUString aAliasName = pEntry->GetAlias();
- if ( nPos != COMBOBOX_ENTRY_NOTFOUND && aAliasName.isEmpty() && aFieldName.indexOf('.') >= 0 )
+ if ( nPos != -1 && aAliasName.isEmpty() && aFieldName.indexOf('.') >= 0 )
{ // special case, we have a table field so we must cut the table name
OUString sTableAlias = aFieldName.getToken(0,'.');
pEntry->SetAlias(sTableAlias);
@@ -2346,8 +2348,12 @@ bool OSelectionBrowseBox::isCutAllowed() const
case BROW_FUNCTION_ROW:
break;
case BROW_FIELD_ROW:
- bCutAllowed = !m_pFieldCell->GetSelected().isEmpty();
+ {
+ weld::ComboBox& rComboBox = m_pFieldCell->get_widget();
+ int nStartPos, nEndPos;
+ bCutAllowed = rComboBox.get_entry_selection_bounds(nStartPos, nEndPos);
break;
+ }
default:
bCutAllowed = !m_pTextCell->GetSelected().isEmpty();
break;
@@ -2361,9 +2367,11 @@ void OSelectionBrowseBox::cut()
switch (nRow)
{
case BROW_FIELD_ROW:
- m_pFieldCell->Cut();
- m_pFieldCell->SetModifyFlag();
+ {
+ weld::ComboBox& rComboBox = m_pFieldCell->get_widget();
+ rComboBox.cut_entry_clipboard();
break;
+ }
default:
m_pTextCell->Cut();
m_pTextCell->SetModifyFlag();
@@ -2380,9 +2388,11 @@ void OSelectionBrowseBox::paste()
switch (nRow)
{
case BROW_FIELD_ROW:
- m_pFieldCell->Paste();
- m_pFieldCell->SetModifyFlag();
+ {
+ weld::ComboBox& rComboBox = m_pFieldCell->get_widget();
+ rComboBox.paste_entry_clipboard();
break;
+ }
default:
m_pTextCell->Paste();
m_pTextCell->SetModifyFlag();
@@ -2418,8 +2428,11 @@ void OSelectionBrowseBox::copy()
switch (nRow)
{
case BROW_FIELD_ROW:
- m_pFieldCell->Copy();
+ {
+ weld::ComboBox& rComboBox = m_pFieldCell->get_widget();
+ rComboBox.copy_entry_clipboard();
break;
+ }
default:
m_pTextCell->Copy();
}
@@ -2616,7 +2629,7 @@ void OSelectionBrowseBox::setFunctionCell(OTableFieldDescRef const & _pEntry)
OSL_ENSURE(!_pEntry->isNumeric(),"Not allowed to combine group by and numeric values!");
m_pFunctionCell->SelectEntry(m_pFunctionCell->GetEntry(m_pFunctionCell->GetEntryCount() - 1));
}
- else if ( m_pFunctionCell->GetEntryPos(_pEntry->GetFunction()) != COMBOBOX_ENTRY_NOTFOUND )
+ else if ( m_pFunctionCell->GetEntryPos(_pEntry->GetFunction()) != LISTBOX_ENTRY_NOTFOUND )
m_pFunctionCell->SelectEntry(_pEntry->GetFunction());
else
m_pFunctionCell->SelectEntryPos(0);
@@ -2633,7 +2646,7 @@ void OSelectionBrowseBox::setFunctionCell(OTableFieldDescRef const & _pEntry)
if ( !bCountRemoved && m_pFunctionCell->GetEntryCount() < 2)
m_pFunctionCell->InsertEntry(m_aFunctionStrings.getToken(2, ';')); // 2 -> COUNT
- if(m_pFunctionCell->GetEntryPos(_pEntry->GetFunction()) != COMBOBOX_ENTRY_NOTFOUND)
+ if(m_pFunctionCell->GetEntryPos(_pEntry->GetFunction()) != LISTBOX_ENTRY_NOTFOUND)
m_pFunctionCell->SelectEntry(_pEntry->GetFunction());
else
m_pFunctionCell->SelectEntryPos(0);