summaryrefslogtreecommitdiff
path: root/sd/source/ui/func
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2023-12-19 19:24:19 +0100
committerSzymon Kłos <szymon.klos@collabora.com>2024-01-11 12:23:27 +0100
commit40c94cff178bd4bef4dc5ce38cc9eb67fe2eb780 (patch)
treeba93e608a9a97879512d17504641dc9072a7c059 /sd/source/ui/func
parentaaf6ce108e91b1504befe19afcee471e3316ae7a (diff)
lok: send error on access denied in image import 2
followup for commit 64624d225c71229acce4f889d4863d7c29c52658 lok: send error on access denied in image import It shows an error in LOK when we try to insert image from remote host blocked by HostFilter Previously it was showing error in paste case, now do the same also on image insertion. For now disable HandleGraphicFilterError in sd, as it crashes, is synchronous and cannot be easily fixed - dialog sits inside module not linked to sfx2, needs some rework. Change-Id: I3c15ff5621add97ef9d60d4f4c1305dae2909158 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161001 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com> Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161774 Tested-by: Jenkins Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Diffstat (limited to 'sd/source/ui/func')
-rw-r--r--sd/source/ui/func/fuinsert.cxx14
1 files changed, 13 insertions, 1 deletions
diff --git a/sd/source/ui/func/fuinsert.cxx b/sd/source/ui/func/fuinsert.cxx
index 31b286c822e3..e8409c815b25 100644
--- a/sd/source/ui/func/fuinsert.cxx
+++ b/sd/source/ui/func/fuinsert.cxx
@@ -36,6 +36,7 @@
#include <svl/stritem.hxx>
#include <sfx2/dispatch.hxx>
+#include <sfx2/lokhelper.hxx>
#include <sfx2/msgpool.hxx>
#include <sfx2/msg.hxx>
#include <svtools/insdlg.hxx>
@@ -60,6 +61,9 @@
#include <svx/charthelper.hxx>
#include <svx/svxids.hrc>
+#include <tools/hostfilter.hxx>
+#include <tools/urlobj.hxx>
+
#include <sdresid.hxx>
#include <View.hxx>
#include <sdmod.hxx>
@@ -129,6 +133,13 @@ void FuInsertGraphic::DoExecute( SfxRequest& rReq )
if ( pArgs->GetItemState( FN_PARAM_1, true, &pItem ) == SfxItemState::SET )
bAsLink = static_cast<const SfxBoolItem*>(pItem)->GetValue();
+ if (comphelper::LibreOfficeKit::isActive())
+ {
+ INetURLObject aURL(aFileName);
+ if (INetProtocol::File != aURL.GetProtocol() && HostFilter::isForbidden(aURL.GetHost()))
+ SfxLokHelper::sendNetworkAccessError("insert");
+ }
+
nError = GraphicFilter::LoadGraphic( aFileName, aFilterName, aGraphic, &GraphicFilter::GetGraphicFilter() );
}
else
@@ -188,8 +199,9 @@ void FuInsertGraphic::DoExecute( SfxRequest& rReq )
}
}
}
- else
+ else if (!comphelper::LibreOfficeKit::isActive())
{
+ // TODO: enable in LOK, it contains synchronous error window without LOKNotifier
SdGRFFilter::HandleGraphicFilterError( nError, GraphicFilter::GetGraphicFilter().GetLastError() );
}
}