summaryrefslogtreecommitdiff
path: root/dbaccess
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-07-01 17:00:44 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-07-02 20:22:05 +0200
commita751d9c414fc63f36ae4b54b8adbaba042b31f60 (patch)
tree14b16f3580b140e0e45da81bb93712ff321b6218 /dbaccess
parent4582ac7de8291a81c867492aad770206fbaca224 (diff)
weld FormattedControl
by using the newly split out Formatter to do the number formatting but input/output to/from a weld::Entry Change-Id: Ic9e619dc5d1ed2fae87e2d89a40dc51f3881468f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97660 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'dbaccess')
-rw-r--r--dbaccess/source/ui/browser/brwctrlr.cxx39
-rw-r--r--dbaccess/source/ui/browser/sbagrid.cxx9
-rw-r--r--dbaccess/source/ui/control/TableGrantCtrl.cxx2
3 files changed, 26 insertions, 24 deletions
diff --git a/dbaccess/source/ui/browser/brwctrlr.cxx b/dbaccess/source/ui/browser/brwctrlr.cxx
index c6a414af1f18..8a0bb0cb6edc 100644
--- a/dbaccess/source/ui/browser/brwctrlr.cxx
+++ b/dbaccess/source/ui/browser/brwctrlr.cxx
@@ -1457,11 +1457,11 @@ FeatureState SbaXDataBrowserController::GetState(sal_uInt16 nId) const
case ID_BROWSER_CUT:
{
CellControllerRef xCurrentController = getBrowserView()->getVclControl()->Controller();
- if (xCurrentController.is() && nullptr != dynamic_cast< const EditCellController* >(xCurrentController.get()))
+ if (const EditCellController* pController = dynamic_cast<const EditCellController*>(xCurrentController.get()))
{
- Edit& rEdit = static_cast<Edit&>(xCurrentController->GetWindow());
- bool bHasLen = (rEdit.GetSelection().Len() != 0);
- bool bIsReadOnly = rEdit.IsReadOnly();
+ const IEditImplementation* pEditImplementation = pController->GetEditImplementation();
+ bool bHasLen = pEditImplementation->GetSelection().Len() != 0;
+ bool bIsReadOnly = pEditImplementation->IsReadOnly();
switch (nId)
{
case ID_BROWSER_CUT: aReturn.bEnabled = m_aCurrentFrame.isActive() && bHasLen && !bIsReadOnly; break;
@@ -1927,22 +1927,23 @@ void SbaXDataBrowserController::Execute(sal_uInt16 nId, const Sequence< Property
case ID_BROWSER_PASTE:
{
CellControllerRef xCurrentController = getBrowserView()->getVclControl()->Controller();
- if (!xCurrentController.is())
- // should be intercepted by GetState. Normally.
- // Unfortunately ID_BROWSER_PASTE is a 'fast call' slot, which means it may be executed without checking if it is
- // enabled. This would be really deadly herein if the current cell has no controller ...
- return;
-
- Edit& rEdit = static_cast<Edit&>(xCurrentController->GetWindow());
- switch (nId)
+ if (EditCellController* pController = dynamic_cast<EditCellController*>(xCurrentController.get()))
{
- case ID_BROWSER_CUT : rEdit.Cut(); break;
- case SID_COPY : rEdit.Copy(); break;
- case ID_BROWSER_PASTE : rEdit.Paste(); break;
- }
- if (ID_BROWSER_CUT == nId || ID_BROWSER_PASTE == nId)
- {
- rEdit.Modify();
+ IEditImplementation* pEditImplementation = pController->GetEditImplementation();
+ switch (nId)
+ {
+ case ID_BROWSER_CUT:
+ pEditImplementation->Cut();
+ break;
+ case SID_COPY:
+ pEditImplementation->Copy();
+ break;
+ case ID_BROWSER_PASTE:
+ pEditImplementation->Paste();
+ break;
+ }
+ if (ID_BROWSER_CUT == nId || ID_BROWSER_PASTE == nId)
+ pController->Modify();
}
}
break;
diff --git a/dbaccess/source/ui/browser/sbagrid.cxx b/dbaccess/source/ui/browser/sbagrid.cxx
index 2089f5dc49a1..b3f442eeb2fa 100644
--- a/dbaccess/source/ui/browser/sbagrid.cxx
+++ b/dbaccess/source/ui/browser/sbagrid.cxx
@@ -1309,9 +1309,9 @@ sal_Int8 SbaGridControl::ExecuteDrop( const BrowserExecuteDropEvent& rEvt )
ActivateCell();
CellControllerRef xCurrentController = Controller();
- if (!xCurrentController.is() || nullptr == dynamic_cast< const EditCellController* >(xCurrentController.get()))
+ EditCellController* pController = dynamic_cast<EditCellController*>(xCurrentController.get());
+ if (!pController)
return DND_ACTION_NONE;
- Edit& rEdit = static_cast<Edit&>(xCurrentController->GetWindow());
// get the dropped string
TransferableDataHelper aDropped( rEvt.maDropEvent.Transferable );
@@ -1319,9 +1319,10 @@ sal_Int8 SbaGridControl::ExecuteDrop( const BrowserExecuteDropEvent& rEvt )
if ( !aDropped.GetString( SotClipboardFormatId::STRING, sDropped ) )
return DND_ACTION_NONE;
- rEdit.SetText( sDropped );
+ IEditImplementation* pEditImplementation = pController->GetEditImplementation();
+ pEditImplementation->SetText(sDropped);
// SetText itself doesn't call a Modify as it isn't a user interaction
- rEdit.Modify();
+ pController->Modify();
return DND_ACTION_COPY;
}
diff --git a/dbaccess/source/ui/control/TableGrantCtrl.cxx b/dbaccess/source/ui/control/TableGrantCtrl.cxx
index 729106eed4a3..dd2f4b4574b8 100644
--- a/dbaccess/source/ui/control/TableGrantCtrl.cxx
+++ b/dbaccess/source/ui/control/TableGrantCtrl.cxx
@@ -275,7 +275,7 @@ void OTableGrantControl::InitController( CellControllerRef& /*rController*/, lon
{
OUString sTablename = m_aTableNames[nRow];
// special case for tablename
- if(nColumnId == COL_TABLE_NAME)
+ if (nColumnId == COL_TABLE_NAME)
m_pEdit->get_widget().set_text(sTablename);
else
{