From 25e4b59b2e9805ebd3c38c40e5591125a05ed5b0 Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Wed, 25 Feb 2015 15:07:19 +0000 Subject: First cut at annotating 'exotic' filters. The idea being that we can improve security by warning for these. Change-Id: I7d993417bfb6a8fe868bc3e07ccbcfe71bf285ff Reviewed-on: https://gerrit.libreoffice.org/50387 Tested-by: Jenkins Reviewed-by: Andras Timar --- filter/source/config/cache/constant.hxx | 1 + filter/source/config/cache/filtercache.cxx | 6 ++++ filter/source/config/fragments/filters/AbiWord.xcu | 2 +- .../config/fragments/filters/MWAW_Bitmap.xcu | 2 +- .../config/fragments/filters/MWAW_Database.xcu | 2 +- .../config/fragments/filters/MWAW_Drawing.xcu | 2 +- .../config/fragments/filters/MWAW_Presentation.xcu | 2 +- .../config/fragments/filters/MWAW_Spreadsheet.xcu | 2 +- .../fragments/filters/MWAW_Text_Document.xcu | 2 +- .../fragments/filters/StarOffice_XML__Base_.xcu | 2 +- .../fragments/filters/StarOffice_XML__Writer_.xcu | 2 +- .../config/fragments/filters/T602Document.xcu | 2 +- filter/source/config/fragments/filters/XPM.xcu | 2 +- .../fragments/filters/writer_MIZI_Hwp_97.xcu | 2 +- include/comphelper/documentconstants.hxx | 4 ++- include/sfx2/docfilt.hxx | 3 ++ include/sfx2/objsh.hxx | 3 ++ offapi/UnoApi_offapi.mk | 1 + .../sun/star/document/ExoticFileLoadException.idl | 34 ++++++++++++++++++ .../schema/org/openoffice/Office/Common.xcs | 23 ++++++++++++ sfx2/Library_sfx.mk | 1 + sfx2/source/doc/exoticfileloadexception.cxx | 42 ++++++++++++++++++++++ sfx2/source/doc/exoticfileloadexception.hxx | 42 ++++++++++++++++++++++ sfx2/source/doc/objstor.cxx | 37 ++++++++++++++++++- uui/inc/ids.hrc | 2 ++ uui/inc/ids.hxx | 1 + uui/source/iahndl.cxx | 25 +++++++++++++ 27 files changed, 235 insertions(+), 14 deletions(-) create mode 100644 offapi/com/sun/star/document/ExoticFileLoadException.idl create mode 100644 sfx2/source/doc/exoticfileloadexception.cxx create mode 100644 sfx2/source/doc/exoticfileloadexception.hxx diff --git a/filter/source/config/cache/constant.hxx b/filter/source/config/cache/constant.hxx index c8a45889ee0e..2a5da1529de3 100644 --- a/filter/source/config/cache/constant.hxx +++ b/filter/source/config/cache/constant.hxx @@ -121,6 +121,7 @@ #define FLAGNAME_TEMPLATEPATH "TEMPLATEPATH" #define FLAGNAME_COMBINED "COMBINED" #define FLAGNAME_SUPPORTSSIGNING "SUPPORTSSIGNING" +#define FLAGNAME_EXOTIC "EXOTIC" /** @short some uno service names. */ diff --git a/filter/source/config/cache/filtercache.cxx b/filter/source/config/cache/filtercache.cxx index f6d80f97540c..bb3bfdc7b9d1 100644 --- a/filter/source/config/cache/filtercache.cxx +++ b/filter/source/config/cache/filtercache.cxx @@ -1843,6 +1843,7 @@ css::uno::Sequence< OUString > FilterCache::impl_convertFlagField2FlagNames(SfxF if (nFlags & SfxFilterFlags::COMBINED ) lFlagNames.emplace_back(FLAGNAME_COMBINED ); if (nFlags & SfxFilterFlags::SUPPORTSSIGNING) lFlagNames.emplace_back(FLAGNAME_SUPPORTSSIGNING); if (nFlags & SfxFilterFlags::GPGENCRYPTION) lFlagNames.emplace_back(FLAGNAME_GPGENCRYPTION); + if (nFlags & SfxFilterFlags::EXOTIC) lFlagNames.emplace_back(FLAGNAME_EXOTIC); return comphelper::containerToSequence(lFlagNames); } @@ -1883,6 +1884,11 @@ SfxFilterFlags FilterCache::impl_convertFlagNames2FlagField(const css::uno::Sequ nField |= SfxFilterFlags::ENCRYPTION; continue; } + if (pNames[i] == FLAGNAME_EXOTIC) + { + nField |= SfxFilterFlags::EXOTIC; + continue; + } if (pNames[i] == FLAGNAME_EXPORT) { nField |= SfxFilterFlags::EXPORT; diff --git a/filter/source/config/fragments/filters/AbiWord.xcu b/filter/source/config/fragments/filters/AbiWord.xcu index 115febd8aafe..a309ac87d379 100644 --- a/filter/source/config/fragments/filters/AbiWord.xcu +++ b/filter/source/config/fragments/filters/AbiWord.xcu @@ -16,7 +16,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . --> - IMPORT ALIEN 3RDPARTYFILTER + IMPORT ALIEN 3RDPARTYFILTER EXOTIC com.sun.star.comp.Writer.AbiWordImportFilter ABW diff --git a/filter/source/config/fragments/filters/MWAW_Bitmap.xcu b/filter/source/config/fragments/filters/MWAW_Bitmap.xcu index 034b72132219..3e70cc62f972 100644 --- a/filter/source/config/fragments/filters/MWAW_Bitmap.xcu +++ b/filter/source/config/fragments/filters/MWAW_Bitmap.xcu @@ -9,7 +9,7 @@ - IMPORT ALIEN 3RDPARTYFILTER PREFERRED + IMPORT ALIEN 3RDPARTYFILTER PREFERRED EXOTIC com.sun.star.comp.Draw.MWAWDrawImportFilter diff --git a/filter/source/config/fragments/filters/MWAW_Database.xcu b/filter/source/config/fragments/filters/MWAW_Database.xcu index 3ff4182ef6c6..075f3ed9e13e 100644 --- a/filter/source/config/fragments/filters/MWAW_Database.xcu +++ b/filter/source/config/fragments/filters/MWAW_Database.xcu @@ -9,7 +9,7 @@ - IMPORT ALIEN 3RDPARTYFILTER PREFERRED + IMPORT ALIEN 3RDPARTYFILTER PREFERRED EXOTIC com.sun.star.comp.Calc.MWAWCalcImportFilter diff --git a/filter/source/config/fragments/filters/MWAW_Drawing.xcu b/filter/source/config/fragments/filters/MWAW_Drawing.xcu index b92f378497dd..1b9ec56d27ee 100644 --- a/filter/source/config/fragments/filters/MWAW_Drawing.xcu +++ b/filter/source/config/fragments/filters/MWAW_Drawing.xcu @@ -9,7 +9,7 @@ - IMPORT ALIEN 3RDPARTYFILTER PREFERRED + IMPORT ALIEN 3RDPARTYFILTER PREFERRED EXOTIC com.sun.star.comp.Draw.MWAWDrawImportFilter diff --git a/filter/source/config/fragments/filters/MWAW_Presentation.xcu b/filter/source/config/fragments/filters/MWAW_Presentation.xcu index 8cfa9445621d..aae6598b27c0 100644 --- a/filter/source/config/fragments/filters/MWAW_Presentation.xcu +++ b/filter/source/config/fragments/filters/MWAW_Presentation.xcu @@ -9,7 +9,7 @@ - IMPORT ALIEN 3RDPARTYFILTER PREFERRED + IMPORT ALIEN 3RDPARTYFILTER PREFERRED EXOTIC com.sun.star.comp.Impress.MWAWPresentationImportFilter diff --git a/filter/source/config/fragments/filters/MWAW_Spreadsheet.xcu b/filter/source/config/fragments/filters/MWAW_Spreadsheet.xcu index db388c55fe44..5461b7fe20ba 100644 --- a/filter/source/config/fragments/filters/MWAW_Spreadsheet.xcu +++ b/filter/source/config/fragments/filters/MWAW_Spreadsheet.xcu @@ -9,7 +9,7 @@ - IMPORT ALIEN 3RDPARTYFILTER PREFERRED + IMPORT ALIEN 3RDPARTYFILTER PREFERRED EXOTIC com.sun.star.comp.Calc.MWAWCalcImportFilter diff --git a/filter/source/config/fragments/filters/MWAW_Text_Document.xcu b/filter/source/config/fragments/filters/MWAW_Text_Document.xcu index f030fb71b198..cfbd5556f29a 100644 --- a/filter/source/config/fragments/filters/MWAW_Text_Document.xcu +++ b/filter/source/config/fragments/filters/MWAW_Text_Document.xcu @@ -9,7 +9,7 @@ - IMPORT ALIEN 3RDPARTYFILTER PREFERRED + IMPORT ALIEN 3RDPARTYFILTER PREFERRED EXOTIC com.sun.star.comp.Writer.MWAWImportFilter diff --git a/filter/source/config/fragments/filters/StarOffice_XML__Base_.xcu b/filter/source/config/fragments/filters/StarOffice_XML__Base_.xcu index 4c33a806fd9d..344843043b7c 100644 --- a/filter/source/config/fragments/filters/StarOffice_XML__Base_.xcu +++ b/filter/source/config/fragments/filters/StarOffice_XML__Base_.xcu @@ -16,7 +16,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . --> - IMPORT OWN DEFAULT 3RDPARTYFILTER ENCRYPTION + IMPORT OWN DEFAULT 3RDPARTYFILTER ENCRYPTION EXOTIC diff --git a/filter/source/config/fragments/filters/StarOffice_XML__Writer_.xcu b/filter/source/config/fragments/filters/StarOffice_XML__Writer_.xcu index ee3638bc0cc8..ba7db694d6ca 100644 --- a/filter/source/config/fragments/filters/StarOffice_XML__Writer_.xcu +++ b/filter/source/config/fragments/filters/StarOffice_XML__Writer_.xcu @@ -16,7 +16,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . --> - IMPORT TEMPLATE OWN ALIEN PREFERRED ENCRYPTION + IMPORT TEMPLATE OWN ALIEN PREFERRED ENCRYPTION EXOTIC CXML diff --git a/filter/source/config/fragments/filters/T602Document.xcu b/filter/source/config/fragments/filters/T602Document.xcu index 436d7c8ea2b6..bf8a68fa691a 100644 --- a/filter/source/config/fragments/filters/T602Document.xcu +++ b/filter/source/config/fragments/filters/T602Document.xcu @@ -16,7 +16,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . --> - IMPORT ALIEN 3RDPARTYFILTER PREFERRED + IMPORT ALIEN 3RDPARTYFILTER PREFERRED EXOTIC com.sun.star.comp.Writer.T602ImportFilter 602 diff --git a/filter/source/config/fragments/filters/XPM.xcu b/filter/source/config/fragments/filters/XPM.xcu index 83c1e32c599b..8a67b710f1a2 100644 --- a/filter/source/config/fragments/filters/XPM.xcu +++ b/filter/source/config/fragments/filters/XPM.xcu @@ -16,7 +16,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . --> - IMPORT ALIEN + IMPORT ALIEN EXOTIC diff --git a/filter/source/config/fragments/filters/writer_MIZI_Hwp_97.xcu b/filter/source/config/fragments/filters/writer_MIZI_Hwp_97.xcu index 1eba0ffbbd3c..2b717c8cb944 100644 --- a/filter/source/config/fragments/filters/writer_MIZI_Hwp_97.xcu +++ b/filter/source/config/fragments/filters/writer_MIZI_Hwp_97.xcu @@ -16,7 +16,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . --> - IMPORT ALIEN 3RDPARTYFILTER + IMPORT ALIEN 3RDPARTYFILTER EXOTIC com.sun.comp.hwpimport.HwpImportFilter diff --git a/include/comphelper/documentconstants.hxx b/include/comphelper/documentconstants.hxx index 9447a7b17fc6..89d5178d33d5 100644 --- a/include/comphelper/documentconstants.hxx +++ b/include/comphelper/documentconstants.hxx @@ -83,6 +83,7 @@ // Preferred - preferred filter for a particular type // 3rdPartyFilter - implemented as a UNO component // Default - default filter for this document type +// Exotic - an unusual/legacy file-format, we don't normally see // // (The 3rdPartyFilter flag is here called StarONE) // @@ -106,6 +107,7 @@ enum class SfxFilterFlags CONSULTSERVICE = 0x00040000L, STARONEFILTER = 0x00080000L, PACKED = 0x00100000L, + EXOTIC = 0x00200000L, COMBINED = 0x00800000L, ENCRYPTION = 0x01000000L, @@ -118,7 +120,7 @@ enum class SfxFilterFlags namespace o3tl { - template<> struct typed_flags : is_typed_flags {}; + template<> struct typed_flags : is_typed_flags {}; } #define SFX_FILTER_NOTINSTALLED (SfxFilterFlags::MUSTINSTALL | SfxFilterFlags::CONSULTSERVICE) diff --git a/include/sfx2/docfilt.hxx b/include/sfx2/docfilt.hxx index 2e8cc62c177d..ceeae3cf980f 100644 --- a/include/sfx2/docfilt.hxx +++ b/include/sfx2/docfilt.hxx @@ -82,7 +82,10 @@ public: bool GetSupportsSigning() const { return bool(nFormatType & SfxFilterFlags::SUPPORTSSIGNING); } bool GetGpgEncryption() const { return bool(nFormatType & SfxFilterFlags::GPGENCRYPTION); } bool IsOwnTemplateFormat() const { return bool(nFormatType & SfxFilterFlags::TEMPLATEPATH); } + /// not our built-in format bool IsAlienFormat() const { return bool(nFormatType & SfxFilterFlags::ALIEN); } + /// an unusual/legacy file to be loading + bool IsExoticFormat() const { return bool(nFormatType & SfxFilterFlags::EXOTIC); } bool CanImport() const { return bool(nFormatType & SfxFilterFlags::IMPORT); } bool CanExport() const { return bool(nFormatType & SfxFilterFlags::EXPORT); } SfxFilterFlags GetFilterFlags() const { return nFormatType; } diff --git a/include/sfx2/objsh.hxx b/include/sfx2/objsh.hxx index 4bf859dadcc8..1f3f085f85ac 100644 --- a/include/sfx2/objsh.hxx +++ b/include/sfx2/objsh.hxx @@ -745,6 +745,9 @@ public: SAL_DLLPRIVATE void ImplSign( bool bScriptingContent = false ); SAL_DLLPRIVATE bool QuerySaveSizeExceededModules_Impl( const css::uno::Reference< css::task::XInteractionHandler >& xHandler ); + SAL_DLLPRIVATE bool QueryAllowExoticFormat_Impl( const css::uno::Reference< css::task::XInteractionHandler >& xHandler, + const OUString& rURL, + const OUString& rFilterUIName); SAL_DLLPRIVATE void CheckOut( ); SAL_DLLPRIVATE void CancelCheckOut( ); diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index 4330d93b77f6..da34ba0a74f7 100644 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -2191,6 +2191,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/document,\ DocumentEvent \ EmptyUndoStackException \ EventObject \ + ExoticFileLoadException \ FilterOptionsRequest \ LinkUpdateModes \ LockFileCorruptRequest \ diff --git a/offapi/com/sun/star/document/ExoticFileLoadException.idl b/offapi/com/sun/star/document/ExoticFileLoadException.idl new file mode 100644 index 000000000000..e742f7edbea7 --- /dev/null +++ b/offapi/com/sun/star/document/ExoticFileLoadException.idl @@ -0,0 +1,34 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +#ifndef __com_sun_star_document_ExoticFileLoadException_idl__ +#define __com_sun_star_document_ExoticFileLoadException_idl__ + +#include + +module com { module sun { module star { module document { + +/** An exception used to notify loading of an exotic file format + @since LibreOffice 6.1 +*/ +exception ExoticFileLoadException : ::com::sun::star::uno::Exception +{ + /** contains the URL of the document + */ + string URL; + + /** contains the UI name of the filter + */ + string FilterUIName; +}; + + +}; }; }; }; + +#endif + diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs index 947067145fd0..9463ff5b7861 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs @@ -2438,6 +2438,29 @@ Contains security specific Office settings. + + + Determines how exotic file formats should be handled. + + + + + Refuse loading without question + + + + + Display a warning and let the user decide + + + + + Always load without question + + + + 2 + Determines if the user has access to the entire diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk index e4c8ab9afe4a..2e2d6513319f 100644 --- a/sfx2/Library_sfx.mk +++ b/sfx2/Library_sfx.mk @@ -214,6 +214,7 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\ sfx2/source/doc/doctempl \ sfx2/source/doc/doctemplates \ sfx2/source/doc/doctemplateslocal \ + sfx2/source/doc/exoticfileloadexception \ sfx2/source/doc/frmdescr \ sfx2/source/doc/graphhelp \ sfx2/source/doc/guisaveas \ diff --git a/sfx2/source/doc/exoticfileloadexception.cxx b/sfx2/source/doc/exoticfileloadexception.cxx new file mode 100644 index 000000000000..46b3c63edd65 --- /dev/null +++ b/sfx2/source/doc/exoticfileloadexception.cxx @@ -0,0 +1,42 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include "exoticfileloadexception.hxx" + +#include +#include + +using namespace com::sun::star; + +ExoticFileLoadException::ExoticFileLoadException(const OUString& rURL, + const OUString& rFilterUIName) +{ + document::ExoticFileLoadException aReq; + aReq.URL = rURL; + aReq.FilterUIName = rFilterUIName; + + m_aRequest <<= aReq; + + m_xAbort.set(uno::Reference(new comphelper::OInteractionAbort), + uno::UNO_QUERY); + m_xApprove.set(uno::Reference(new comphelper::OInteractionApprove), + uno::UNO_QUERY); + m_lContinuations.realloc(2); + m_lContinuations[0] = m_xApprove; + m_lContinuations[1] = m_xAbort; +} + +bool ExoticFileLoadException::isApprove() const +{ + comphelper::OInteractionApprove* pBase + = static_cast(m_xApprove.get()); + return pBase->wasSelected(); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/exoticfileloadexception.hxx b/sfx2/source/doc/exoticfileloadexception.hxx new file mode 100644 index 000000000000..3f8d480d8fb6 --- /dev/null +++ b/sfx2/source/doc/exoticfileloadexception.hxx @@ -0,0 +1,42 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef INCLUDED_SFX2_EXOTICFILELOADEXCEPTION_HXX +#define INCLUDED_SFX2_EXOTICFILELOADEXCEPTION_HXX + +#include +#include + +class ExoticFileLoadException : public cppu::WeakImplHelper +{ + // C++ interface +public: + ExoticFileLoadException(const OUString& rURL, const OUString& rFilterUIName); + bool isApprove() const; + + // UNO interface +public: + virtual css::uno::Sequence> + SAL_CALL getContinuations() override + { + return m_lContinuations; + } + css::uno::Any SAL_CALL getRequest() override { return m_aRequest; } + + // member +private: + css::uno::Any m_aRequest; + css::uno::Sequence> m_lContinuations; + css::uno::Reference m_xAbort; + css::uno::Reference m_xApprove; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index feff5dfd91a1..13fb401a5e3a 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -81,6 +81,7 @@ #include #include #include +#include #include #include #include @@ -130,6 +131,7 @@ #include #include #include "objstor.hxx" +#include "exoticfileloadexception.hxx" using namespace ::com::sun::star; using namespace ::com::sun::star::container; @@ -651,6 +653,11 @@ bool SfxObjectShell::DoLoad( SfxMedium *pMed ) SetError( ERRCODE_IO_FILTERDISABLED ); } + if ( pFilter && pFilter->IsExoticFormat() && !QueryAllowExoticFormat_Impl( getInteractionHandler(), aBaseURL, pMed->GetFilter()->GetUIName() ) ) + { + SetError( ERRCODE_IO_ABORT ); + } + // initialize static language table so language-related extensions are learned before the document loads (void)SvtLanguageTable::GetLanguageEntryCount(); @@ -3557,7 +3564,35 @@ bool SfxObjectShell::QuerySaveSizeExceededModules_Impl( const uno::Reference< ta return true; } -// comphelper::IEmbeddedHelper +bool SfxObjectShell::QueryAllowExoticFormat_Impl( const uno::Reference< task::XInteractionHandler >& xHandler, const OUString& rURL, const OUString& rFilterUIName ) +{ + if ( SvtSecurityOptions().isTrustedLocationUri( rURL ) ) + { + // Always load from trusted location + return true; + } + if ( officecfg::Office::Common::Security::LoadExoticFileFormats::get() == 0 ) + { + // Refuse loading without question + return false; + } + else if ( officecfg::Office::Common::Security::LoadExoticFileFormats::get() == 2 ) + { + // Always load without question + return true; + } + else if ( officecfg::Office::Common::Security::LoadExoticFileFormats::get() == 1 && xHandler.is() ) + { + // Display a warning and let the user decide + rtl::Reference xException(new ExoticFileLoadException( rURL, rFilterUIName )); + uno::Reference< task::XInteractionRequest > xReq( xException.get() ); + xHandler->handle( xReq ); + return xException.get()->isApprove(); + } + // No interaction handler, default is to continue to load + return true; +} + uno::Reference< task::XInteractionHandler > SfxObjectShell::getInteractionHandler() const { uno::Reference< task::XInteractionHandler > xRet; diff --git a/uui/inc/ids.hrc b/uui/inc/ids.hrc index d5a418918ec5..84d409f083ef 100644 --- a/uui/inc/ids.hrc +++ b/uui/inc/ids.hrc @@ -34,6 +34,8 @@ const std::pair RID_UUI_ERRHDL[] = ERRCODE_UUI_IO_TARGETALREADYEXISTS }, { NC_("RID_UUI_ERRHDL", "You are about to save/export a password protected basic library containing module(s) \n$(ARG1)\nwhich are too large to store in binary format. If you wish users that don't have access to the library password to be able to run macros in those module(s) you must split those modules into a number of smaller modules. Do you wish to continue to save/export this library?"), ERRCODE_UUI_IO_MODULESIZEEXCEEDED }, + { NC_("RID_UUI_ERRHDL", "Beware!\n\nYou are about to load a very unusual sort of file ($(ARG2)) from the URL:\n\n$(ARG1)\n\nAre you certain that this file is a legacy document created many years ago?"), + ERRCODE_UUI_IO_EXOTICFILEFORMAT }, { NC_("RID_UUI_ERRHDL", "The data from $(ARG1) has an incorrect checksum."), ERRCODE_UUI_IO_BADCRC }, { NC_("RID_UUI_ERRHDL", "The object $(ARG1) cannot be created in directory $(ARG2)."), diff --git a/uui/inc/ids.hxx b/uui/inc/ids.hxx index 2d3b6d4e7408..71beff973f02 100644 --- a/uui/inc/ids.hxx +++ b/uui/inc/ids.hxx @@ -86,6 +86,7 @@ #define ERRCODE_UUI_LOCKING_NOT_LOCKED ErrCode(ErrCodeArea::Uui, 61) #define ERRCODE_UUI_LOCKING_LOCK_EXPIRED ErrCode(ErrCodeArea::Uui, 62) #define ERRCODE_UUI_CANNOT_ACTIVATE_FACTORY ErrCode(ErrCodeArea::Uui, 63) +#define ERRCODE_UUI_IO_EXOTICFILEFORMAT ErrCode(ErrCodeArea::Uui, 64) #endif diff --git a/uui/source/iahndl.cxx b/uui/source/iahndl.cxx index 228ff20af632..6dbe7df63e76 100644 --- a/uui/source/iahndl.cxx +++ b/uui/source/iahndl.cxx @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -434,6 +435,30 @@ UUIInteractionHelper::handleRequest_impl( return true; } + document::ExoticFileLoadException aExoticFileLoadException; + if (aAnyRequest >>= aExoticFileLoadException) + { + std::vector< OUString > aArguments; + + if( !aExoticFileLoadException.URL.isEmpty() ) + { + aArguments.push_back( aExoticFileLoadException.URL ); + } + if( !aExoticFileLoadException.FilterUIName.isEmpty() ) + { + aArguments.push_back( aExoticFileLoadException.FilterUIName ); + } + + handleErrorHandlerRequest( task::InteractionClassification_WARNING, + ERRCODE_UUI_IO_EXOTICFILEFORMAT, + aArguments, + rRequest->getContinuations(), + bObtainErrorStringOnly, + bHasErrorString, + rErrorString); + return true; + } + ucb::NameClashException aNCException; if (aAnyRequest >>= aNCException) { -- cgit