From a2baea7faff31d26459dab3668a39eae85e4991b Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 15 Apr 2024 11:27:30 +0200 Subject: Adding upstream version 4:24.2.1. Signed-off-by: Daniel Baumann --- sc/source/ui/app/inputhdl.cxx | 3 ++- sc/source/ui/app/transobj.cxx | 46 ++++++++++++++++++++++++------------------- 2 files changed, 28 insertions(+), 21 deletions(-) (limited to 'sc/source/ui/app') diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index 809ba8520e..a640d71cb2 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -3159,7 +3159,7 @@ void ScInputHandler::EnterHandler( ScEnterMode nBlockMode, bool bBeforeSavingInL { ScDocument& rDoc = pActiveViewSh->GetViewData().GetDocument(); const ScValidationData* pData = rDoc.GetValidationEntry( nValidation ); - if (pData && pData->HasErrMsg()) + if (pData) { // #i67990# don't use pLastPattern in EnterHandler const ScPatternAttr* pPattern = rDoc.GetPattern( aCursorPos.Col(), aCursorPos.Row(), aCursorPos.Tab() ); @@ -3200,6 +3200,7 @@ void ScInputHandler::EnterHandler( ScEnterMode nBlockMode, bool bBeforeSavingInL if (pData->DoError(pActiveViewSh->GetFrameWeld(), aString, aCursorPos)) bForget = true; // Do not take over input + } } } diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx index 6a1ef6a046..5f0599c888 100644 --- a/sc/source/ui/app/transobj.cxx +++ b/sc/source/ui/app/transobj.cxx @@ -312,28 +312,34 @@ bool ScTransferObj::GetData( const datatransfer::DataFlavor& rFlavor, const OUSt ScAddress aPos(nCol, nRow, nTab); const ScPatternAttr* pPattern = m_pDoc->GetPattern( nCol, nRow, nTab ); - ScTabEditEngine aEngine( *pPattern, m_pDoc->GetEditPool(), m_pDoc.get() ); - ScRefCellValue aCell(*m_pDoc, aPos); - if (aCell.getType() == CELLTYPE_EDIT) + if (pPattern) { - const EditTextObject* pObj = aCell.getEditText(); - aEngine.SetTextCurrentDefaults(*pObj); - } - else - { - SvNumberFormatter* pFormatter = m_pDoc->GetFormatTable(); - sal_uInt32 nNumFmt = pPattern->GetNumberFormat(pFormatter); - const Color* pColor; - OUString aText = ScCellFormat::GetString(aCell, nNumFmt, &pColor, *pFormatter, *m_pDoc); - if (!aText.isEmpty()) - aEngine.SetTextCurrentDefaults(aText); - } + ScTabEditEngine aEngine(*pPattern, m_pDoc->GetEditPool(), m_pDoc.get()); + ScRefCellValue aCell(*m_pDoc, aPos); + if (aCell.getType() == CELLTYPE_EDIT) + { + const EditTextObject* pObj = aCell.getEditText(); + aEngine.SetTextCurrentDefaults(*pObj); + } + else + { + SvNumberFormatter* pFormatter = m_pDoc->GetFormatTable(); + sal_uInt32 nNumFmt = pPattern->GetNumberFormat(pFormatter); + const Color* pColor; + OUString aText + = ScCellFormat::GetString(aCell, nNumFmt, &pColor, *pFormatter, *m_pDoc); + if (!aText.isEmpty()) + aEngine.SetTextCurrentDefaults(aText); + } - bOK = SetObject( &aEngine, - ((nFormat == SotClipboardFormatId::RTF) ? SCTRANS_TYPE_EDIT_RTF : - ((nFormat == SotClipboardFormatId::EDITENGINE_ODF_TEXT_FLAT) ? - SCTRANS_TYPE_EDIT_ODF_TEXT_FLAT : SCTRANS_TYPE_EDIT_BIN)), - rFlavor ); + bOK = SetObject(&aEngine, + ((nFormat == SotClipboardFormatId::RTF) + ? SCTRANS_TYPE_EDIT_RTF + : ((nFormat == SotClipboardFormatId::EDITENGINE_ODF_TEXT_FLAT) + ? SCTRANS_TYPE_EDIT_ODF_TEXT_FLAT + : SCTRANS_TYPE_EDIT_BIN)), + rFlavor); + } } else if ( ScImportExport::IsFormatSupported( nFormat ) || nFormat == SotClipboardFormatId::RTF || nFormat == SotClipboardFormatId::RICHTEXT ) -- cgit v1.2.3