include/sfx2/opengrf.hxx | 2 ++ sc/source/core/data/document.cxx | 9 +++++++++ sc/source/ui/drawfunc/fuins1.cxx | 9 +++++++++ sd/inc/sdgrffilter.hxx | 3 ++- sd/source/filter/grf/sdgrffilter.cxx | 12 +++++++----- sd/source/ui/func/fuinsert.cxx | 7 ++++--- sfx2/source/appl/opengrf.cxx | 28 ++++++++++++++-------------- sw/source/uibase/uiview/view2.cxx | 2 +- 8 files changed, 48 insertions(+), 24 deletions(-)
New commits: commit 1276ce6c03ed9c126cff5a3be48133f1a5c29aad Author: Pranam Lashkari <[email protected]> AuthorDate: Fri Nov 28 21:55:06 2025 +0530 Commit: Caolán McNamara <[email protected]> CommitDate: Fri Dec 5 11:25:06 2025 +0100 LOK: show warning/error dialogs show error dialog when invalid images are inserted (calc, impress) part 2 of 70d8195a2b72440fe929e4e3761d1f1d5ace0096 problem: when inserted and image in calc or impress, and image format is incorrect or not supported (i.e: .txt, .heic) then LOK did not get any failure messages Change-Id: I8af0cd5cf360574c116e6383ada170e32e317d12 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194801 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Pranam Lashkari <[email protected]> (cherry picked from commit 86e643a4c4a26401bee8b636f7068859ab7fc683) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194955 Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Caolán McNamara <[email protected]> diff --git a/include/sfx2/opengrf.hxx b/include/sfx2/opengrf.hxx index 4546fbabc726..94fed4e4b52e 100644 --- a/include/sfx2/opengrf.hxx +++ b/include/sfx2/opengrf.hxx @@ -22,6 +22,7 @@ #include <sfx2/dllapi.h> #include <rtl/ustring.hxx> #include <comphelper/errcode.hxx> +#include <unotools/resmgr.hxx> namespace com::sun::star::ui::dialogs { class XFilePickerControlAccess; } namespace com::sun::star::uno { template <class interface_type> class Reference; } @@ -58,6 +59,7 @@ public: void SetDetectedFilter(const OUString&); css::uno::Reference<css::ui::dialogs::XFilePickerControlAccess> const & GetFilePickerControlAccess() const; + static TranslateId SvxOpenGrfErr2ResId(ErrCode err); private: SvxOpenGraphicDialog (const SvxOpenGraphicDialog&) = delete; diff --git a/sc/source/ui/drawfunc/fuins1.cxx b/sc/source/ui/drawfunc/fuins1.cxx index d8eda3aba080..e5cad07b2c4a 100644 --- a/sc/source/ui/drawfunc/fuins1.cxx +++ b/sc/source/ui/drawfunc/fuins1.cxx @@ -25,6 +25,7 @@ #include <sfx2/lokhelper.hxx> #include <sfx2/opengrf.hxx> #include <sfx2/viewfrm.hxx> +#include <sfx2/sfxresid.hxx> #include <svx/svdograf.hxx> #include <svx/svdomedia.hxx> #include <svx/svdpage.hxx> @@ -288,6 +289,14 @@ FuInsertGraphic::FuInsertGraphic( ScTabViewShell& rViewSh, { lcl_InsertGraphic( aGraphic, aFileName, bAsLink, true, rViewSh, pWindow, pView ); } + else + { + std::shared_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog( + pWin->GetFrameWeld(), VclMessageType::Warning, VclButtonsType::Ok, + SfxResId(SvxOpenGraphicDialog::SvxOpenGrfErr2ResId(nError)))); + + xWarn->runAsync(xWarn, [](sal_uInt32) {}); + } } else { diff --git a/sd/inc/sdgrffilter.hxx b/sd/inc/sdgrffilter.hxx index a90934dd6dea..32647a371870 100644 --- a/sd/inc/sdgrffilter.hxx +++ b/sd/inc/sdgrffilter.hxx @@ -33,7 +33,8 @@ public: bool Import(); bool Export() override; - static void HandleGraphicFilterError(ErrCode nFilterError, ErrCode nStreamError); + static void HandleGraphicFilterError(ErrCode nFilterError, ErrCode nStreamError, + weld::Window* frameWeld = nullptr); static void InsertSdrGrafObj(const Graphic& rGraphic, SdPage* pPage); }; diff --git a/sd/source/filter/grf/sdgrffilter.cxx b/sd/source/filter/grf/sdgrffilter.cxx index ea437dfb2ee0..10ad074709c4 100644 --- a/sd/source/filter/grf/sdgrffilter.cxx +++ b/sd/source/filter/grf/sdgrffilter.cxx @@ -103,7 +103,8 @@ SdGRFFilter::~SdGRFFilter() { } -void SdGRFFilter::HandleGraphicFilterError( ErrCode nFilterError, ErrCode nStreamError ) +void SdGRFFilter::HandleGraphicFilterError(ErrCode nFilterError, ErrCode nStreamError, + weld::Window* frameWeld) { if (ERRCODE_NONE != nStreamError) { @@ -130,11 +131,12 @@ void SdGRFFilter::HandleGraphicFilterError( ErrCode nFilterError, ErrCode nStrea if (pId && pId == STR_IMPORT_GRFILTER_IOERROR) ErrorHandler::HandleError( ERRCODE_IO_GENERAL ); - else + else if (frameWeld || !comphelper::LibreOfficeKit::isActive()) { - std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(nullptr, - VclMessageType::Warning, VclButtonsType::Ok, pId ? SdResId(pId) : OUString())); - xErrorBox->run(); + std::shared_ptr<weld::MessageDialog> xErrorBox( + Application::CreateMessageDialog(frameWeld, VclMessageType::Warning, VclButtonsType::Ok, + pId ? SdResId(pId) : OUString())); + xErrorBox->runAsync(xErrorBox, [](sal_uInt32) {}); } } diff --git a/sd/source/ui/func/fuinsert.cxx b/sd/source/ui/func/fuinsert.cxx index fd26dc295c76..bf3aa29db630 100644 --- a/sd/source/ui/func/fuinsert.cxx +++ b/sd/source/ui/func/fuinsert.cxx @@ -186,10 +186,11 @@ void FuInsertGraphic::DoExecute( SfxRequest& rReq ) } } } - else if (!comphelper::LibreOfficeKit::isActive()) + else { - // TODO: enable in LOK, it contains synchronous error window without LOKNotifier - SdGRFFilter::HandleGraphicFilterError( nError, GraphicFilter::GetGraphicFilter().GetLastError() ); + SdGRFFilter::HandleGraphicFilterError(nError, + GraphicFilter::GetGraphicFilter().GetLastError(), + mpWindow ? mpWindow->GetFrameWeld() : nullptr); } } diff --git a/sfx2/source/appl/opengrf.cxx b/sfx2/source/appl/opengrf.cxx index 16e0731f310b..617f417f40f6 100644 --- a/sfx2/source/appl/opengrf.cxx +++ b/sfx2/source/appl/opengrf.cxx @@ -45,20 +45,6 @@ using namespace ::com::sun::star::lang; using namespace ::com::sun::star::ui::dialogs; using namespace ::com::sun::star::uno; -static TranslateId SvxOpenGrfErr2ResId( ErrCode err ) -{ - if (err == ERRCODE_GRFILTER_OPENERROR) - return RID_SVXSTR_GRFILTER_OPENERROR; - else if (err == ERRCODE_GRFILTER_IOERROR) - return RID_SVXSTR_GRFILTER_IOERROR; - else if (err == ERRCODE_GRFILTER_VERSIONERROR) - return RID_SVXSTR_GRFILTER_VERSIONERROR; - else if (err == ERRCODE_GRFILTER_FILTERERROR) - return RID_SVXSTR_GRFILTER_FILTERERROR; - else - return RID_SVXSTR_GRFILTER_FORMATERROR; -} - struct SvxOpenGrf_Impl { SvxOpenGrf_Impl(weld::Window* pPreferredParent, @@ -277,6 +263,20 @@ void SvxOpenGraphicDialog::SetDetectedFilter(const OUString& rStr) mpImpl->sDetectedFilter = rStr; } +TranslateId SvxOpenGraphicDialog::SvxOpenGrfErr2ResId(ErrCode err) +{ + if (err == ERRCODE_GRFILTER_OPENERROR) + return RID_SVXSTR_GRFILTER_OPENERROR; + else if (err == ERRCODE_GRFILTER_IOERROR) + return RID_SVXSTR_GRFILTER_IOERROR; + else if (err == ERRCODE_GRFILTER_VERSIONERROR) + return RID_SVXSTR_GRFILTER_VERSIONERROR; + else if (err == ERRCODE_GRFILTER_FILTERERROR) + return RID_SVXSTR_GRFILTER_FILTERERROR; + else + return RID_SVXSTR_GRFILTER_FORMATERROR; +} + Reference<ui::dialogs::XFilePickerControlAccess> const & SvxOpenGraphicDialog::GetFilePickerControlAccess() const { return mpImpl->xCtrlAcc; commit 314498cf59553b70704851a0e8b827f263775d89 Author: Pranam Lashkari <[email protected]> AuthorDate: Fri Nov 28 19:02:10 2025 +0530 Commit: Caolán McNamara <[email protected]> CommitDate: Fri Dec 5 11:24:56 2025 +0100 LOK: show warning/error dialogs show error dialog when invalid images are inserted show error dialog when sheet rename was invalid Change-Id: I9bf6bb25ac247e966da36bffcda3284d5d82ae42 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194778 Tested-by: Caolán McNamara <[email protected]> Reviewed-by: Caolán McNamara <[email protected]> (cherry picked from commit 70d8195a2b72440fe929e4e3761d1f1d5ace0096) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194954 diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index d1c157dece3c..91d1504a6f0b 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -23,6 +23,7 @@ #include <editeng/editobj.hxx> #include <svx/svditer.hxx> #include <sfx2/docfile.hxx> +#include <sfx2/viewfrm.hxx> #include <svl/numformat.hxx> #include <poolcach.hxx> #include <svl/zforlist.hxx> @@ -915,6 +916,14 @@ bool ScDocument::RenameTab( SCTAB nTab, const OUString& rName, bool bExternalDoc SfxLokHelper::notifyDocumentSizeChangedAllViews(pModel); } } + else + { + OUString aErrMsg(ScResId(STR_INVALIDTABNAME)); + std::shared_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog( + GetDocumentShell()->GetFrame()->GetFrameWeld(), VclMessageType::Warning, + VclButtonsType::Ok, aErrMsg)); + xBox->runAsync(xBox, [](sal_uInt32) {}); + } } collectUIInformation({{"NewName", rName}}, u"Rename_Sheet"_ustr); diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index 2029adbacc16..fa214e0e9334 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -392,7 +392,7 @@ bool SwView::InsertGraphicDlg( SfxRequest& rReq ) OUString sGraphicFormat = SwResId(STR_POOLFRM_GRAPHIC); const SfxStringItem* pName = rReq.GetArg<SfxStringItem>(SID_INSERT_GRAPHIC); - bool bShowError = !pName; + bool bShowError = !pName || comphelper::LibreOfficeKit::isActive(); // No file pickers in a non-desktop (mobile app) build.
