From a751d9c414fc63f36ae4b54b8adbaba042b31f60 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Wed, 1 Jul 2020 17:00:44 +0100 Subject: weld FormattedControl MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- dbaccess/source/ui/browser/brwctrlr.cxx | 39 ++++++++++++++------------- dbaccess/source/ui/browser/sbagrid.cxx | 9 ++++--- dbaccess/source/ui/control/TableGrantCtrl.cxx | 2 +- 3 files changed, 26 insertions(+), 24 deletions(-) (limited to 'dbaccess') 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(xCurrentController.get())) { - Edit& rEdit = static_cast(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(xCurrentController->GetWindow()); - switch (nId) + if (EditCellController* pController = dynamic_cast(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(xCurrentController.get()); + if (!pController) return DND_ACTION_NONE; - Edit& rEdit = static_cast(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 { -- cgit