From 7f198b27f427f3cd3a19482ad971dc78a978d425 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Wed, 3 Dec 2025 15:44:45 +0500 Subject: [PATCH] Drop class utl::MediaDescriptor, and use comphelper::SequenceAsHashMap utl::MediaDescriptor was just a SequenceAsHashMap with a few added methods. It made it more difficult to assign a SequenceAsHashMap to MediaDescriptor, without real upsides. In many places, the class was used not as media descriptor, but just as helper to create sequences. This change puts the string constants and the former methods into a namespace utl::MediaDescriptor. It would be also good to drop comphelper::NamedValueCollection, which is basically a twin of comphelper::SequenceAsHashMap (TODO). Change-Id: Ia9b69c5a2ad153ecc654944c419c1880252ed86e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195163 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- avmedia/source/framework/soundhandler.cxx | 5 +- .../controller/main/ChartFrameloader.cxx | 9 +- desktop/source/app/dispatchwatcher.cxx | 5 +- desktop/source/lib/init.cxx | 4 +- .../source/commonembedding/persistence.cxx | 3 +- filter/qa/unit/svg.cxx | 4 +- filter/qa/unit/textfilterdetect.cxx | 6 +- filter/source/config/cache/typedetection.cxx | 31 +- filter/source/config/cache/typedetection.hxx | 23 +- .../storagefilterdetect/filterdetect.cxx | 16 +- filter/source/svg/svgfilter.cxx | 5 +- .../source/textfilterdetect/filterdetect.cxx | 46 +- .../xmlfilteradaptor/XmlFilterAdaptor.cxx | 4 +- framework/inc/classes/taskcreator.hxx | 4 +- framework/source/classes/taskcreator.cxx | 5 +- framework/source/dispatch/oxt_handler.cxx | 4 +- framework/source/fwe/helper/titlehelper.cxx | 2 +- .../source/helper/statusindicatorfactory.cxx | 2 +- framework/source/inc/loadenv/loadenv.hxx | 6 +- framework/source/layoutmanager/helpers.cxx | 3 +- framework/source/loadenv/loadenv.cxx | 28 +- framework/source/services/autorecovery.cxx | 32 +- framework/source/services/desktop.cxx | 6 +- framework/source/services/dispatchhelper.cxx | 4 +- framework/source/services/frame.cxx | 6 +- framework/source/uielement/toolbarmanager.cxx | 3 +- hwpfilter/source/hwpreader.cxx | 9 +- include/oox/core/filterbase.hxx | 11 +- include/oox/core/filterdetect.hxx | 4 +- include/oox/core/xmlfilterbase.hxx | 6 +- include/unotools/mediadescriptor.hxx | 431 +++++------ oox/source/core/filterbase.cxx | 24 +- oox/source/core/filterdetect.cxx | 25 +- oox/source/core/xmlfilterbase.cxx | 14 +- .../drawingml/chart/objectformatter.cxx | 1 + oox/source/drawingml/shape.cxx | 1 + reportdesign/inc/ReportDefinition.hxx | 6 +- .../source/core/api/ReportDefinition.cxx | 15 +- reportdesign/source/filter/xml/xmlfilter.cxx | 3 +- .../source/ui/report/ReportController.cxx | 2 +- sc/source/filter/oox/viewsettings.cxx | 1 + sc/source/filter/oox/workbooksettings.cxx | 1 + sc/source/filter/orcus/filterdetect.cxx | 3 +- sc/source/ui/docshell/docsh.cxx | 3 +- sc/source/ui/unoobj/exceldetect.cxx | 18 +- sc/source/ui/unoobj/scdetect.cxx | 10 +- .../source/provider/BrowseNodeFactoryImpl.cxx | 3 +- sd/qa/unit/SdrPdfImportTest.cxx | 4 +- .../factories/BasicToolBarFactory.cxx | 3 +- sd/source/ui/unoidl/sddetect.cxx | 10 +- sfx2/source/appl/fileobj.cxx | 3 +- sfx2/source/bastyp/fltfnc.cxx | 2 +- sfx2/source/control/unoctitm.cxx | 4 +- sfx2/source/doc/DocumentMetadataAccess.cxx | 10 +- sfx2/source/doc/SfxDocumentMetaData.cxx | 10 +- sfx2/source/doc/docfile.cxx | 12 +- sfx2/source/doc/objmisc.cxx | 4 +- sfx2/source/doc/objstor.cxx | 2 +- sfx2/source/doc/sfxbasemodel.cxx | 6 +- starmath/source/smdetect.cxx | 6 +- starmath/source/unofilter.cxx | 5 +- svx/qa/unit/unodraw.cxx | 4 +- sw/qa/core/undo/undo.cxx | 4 +- sw/qa/extras/globalfilter/globalfilter.cxx | 10 +- .../extras/tiledrendering/tiledrendering.cxx | 6 +- sw/qa/extras/unowriter/unowriter.cxx | 3 +- .../core/docnode/retrieveinputstream.cxx | 7 +- sw/source/core/layout/dumpfilter.cxx | 3 +- sw/source/core/unocore/unocrsrhelper.cxx | 2 +- sw/source/filter/html/htmlplug.cxx | 6 +- .../filter/indexing/IndexingExportFilter.cxx | 3 +- sw/source/filter/ww8/docxexportfilter.cxx | 1 + sw/source/filter/ww8/rtfexportfilter.cxx | 3 +- sw/source/ui/uno/swdetect.cxx | 8 +- .../writerfilter/dmapper/DomainMapper.cxx | 4 +- .../writerfilter/dmapper/DomainMapper.hxx | 6 +- .../dmapper/DomainMapper_Impl.cxx | 2 +- .../dmapper/DomainMapper_Impl.hxx | 2 +- sw/source/writerfilter/dmapper/OLEHandler.cxx | 4 +- .../dmapper/domainmapperfactory.cxx | 3 +- sw/source/writerfilter/filter/RtfFilter.cxx | 4 +- .../writerfilter/filter/WriterFilter.cxx | 3 +- .../inc/dmapper/DomainMapperFactory.hxx | 6 +- .../writerfilter/inc/rtftok/RTFDocument.hxx | 5 +- .../writerfilter/ooxml/OOXMLDocumentImpl.cxx | 6 +- .../rtftok/rtfdocumentfactory.cxx | 4 +- .../writerfilter/rtftok/rtfdocumentimpl.cxx | 3 +- .../writerfilter/rtftok/rtfdocumentimpl.hxx | 4 +- test/source/unoapi_test.cxx | 3 +- unotools/source/misc/mediadescriptor.cxx | 674 ++++++++++-------- .../source/vbahelper/vbadocumentsbase.cxx | 5 +- .../cppunit/pdfexport/PDFEncryptionTest.cxx | 4 +- vcl/qa/cppunit/pdfexport/pdfexport.cxx | 4 +- vcl/qa/cppunit/pdfexport/pdfexport2.cxx | 4 +- writerperfect/inc/ImportFilter.hxx | 5 +- writerperfect/qa/unit/DrawingImportTest.cxx | 4 +- writerperfect/qa/unit/EPUBExportTest.cxx | 4 +- writerperfect/qa/unit/ImportTest.cxx | 3 +- .../qa/unit/PresentationImportTest.cxx | 5 +- .../qa/unit/SpreadsheetImportTest.cxx | 5 +- writerperfect/qa/unit/TextImportTest.cxx | 4 +- .../source/calc/MSWorksCalcImportFilter.cxx | 5 +- .../source/calc/MSWorksCalcImportFilter.hxx | 3 +- .../source/calc/MWAWCalcImportFilter.cxx | 3 +- .../source/calc/MWAWCalcImportFilter.hxx | 3 +- .../source/calc/NumbersImportFilter.cxx | 2 +- .../source/calc/NumbersImportFilter.hxx | 3 +- .../calc/StarOfficeCalcImportFilter.cxx | 3 +- .../calc/StarOfficeCalcImportFilter.hxx | 3 +- writerperfect/source/draw/CDRImportFilter.cxx | 2 +- writerperfect/source/draw/CDRImportFilter.hxx | 3 +- writerperfect/source/draw/CMXImportFilter.cxx | 2 +- writerperfect/source/draw/CMXImportFilter.hxx | 3 +- .../source/draw/FreehandImportFilter.cxx | 3 +- .../source/draw/FreehandImportFilter.hxx | 3 +- .../source/draw/MSPUBImportFilter.cxx | 2 +- .../source/draw/MSPUBImportFilter.hxx | 3 +- .../source/draw/MWAWDrawImportFilter.cxx | 3 +- .../source/draw/MWAWDrawImportFilter.hxx | 3 +- .../source/draw/PageMakerImportFilter.cxx | 3 +- .../source/draw/PageMakerImportFilter.hxx | 3 +- writerperfect/source/draw/QXPImportFilter.cxx | 2 +- writerperfect/source/draw/QXPImportFilter.hxx | 3 +- .../draw/StarOfficeDrawImportFilter.cxx | 3 +- .../draw/StarOfficeDrawImportFilter.hxx | 3 +- .../source/draw/VisioImportFilter.cxx | 2 +- .../source/draw/VisioImportFilter.hxx | 3 +- writerperfect/source/draw/WPGImportFilter.cxx | 2 +- writerperfect/source/draw/WPGImportFilter.hxx | 3 +- writerperfect/source/draw/ZMFImportFilter.cxx | 2 +- writerperfect/source/draw/ZMFImportFilter.hxx | 3 +- .../source/impress/KeynoteImportFilter.cxx | 2 +- .../source/impress/KeynoteImportFilter.hxx | 3 +- .../impress/MWAWPresentationImportFilter.cxx | 3 +- .../impress/MWAWPresentationImportFilter.hxx | 3 +- .../StarOfficePresentationImportFilter.cxx | 2 +- .../StarOfficePresentationImportFilter.hxx | 3 +- .../source/writer/AbiWordImportFilter.cxx | 2 +- .../source/writer/AbiWordImportFilter.hxx | 3 +- .../source/writer/EBookImportFilter.cxx | 5 +- .../source/writer/EBookImportFilter.hxx | 2 +- .../source/writer/EPUBExportFilter.cxx | 3 +- writerperfect/source/writer/EPUBPackage.cxx | 3 +- .../source/writer/MSWorksImportFilter.cxx | 3 +- .../source/writer/MSWorksImportFilter.hxx | 3 +- .../source/writer/MWAWImportFilter.cxx | 2 +- .../source/writer/MWAWImportFilter.hxx | 3 +- .../source/writer/PagesImportFilter.cxx | 2 +- .../source/writer/PagesImportFilter.hxx | 2 +- .../writer/StarOfficeWriterImportFilter.cxx | 3 +- .../writer/StarOfficeWriterImportFilter.hxx | 3 +- xmloff/source/chart/SchXMLChartContext.cxx | 7 +- .../source/helper/pdfsignaturehelper.cxx | 4 +- 153 files changed, 984 insertions(+), 944 deletions(-) diff --git a/avmedia/source/framework/soundhandler.cxx b/avmedia/source/framework/soundhandler.cxx index 6b9045cc5efd..beb4a2e13548 100644 --- a/avmedia/source/framework/soundhandler.cxx +++ b/avmedia/source/framework/soundhandler.cxx @@ -19,6 +19,7 @@ #include "soundhandler.hxx" +#include #include #include @@ -108,7 +109,7 @@ void SAL_CALL SoundHandler::dispatchWithNotification(const css::util::URL& // SAFE { const std::unique_lock aLock(m_aMutex); - utl::MediaDescriptor aDescriptor(lDescriptor); + comphelper::SequenceAsHashMap aDescriptor(lDescriptor); { //close streams otherwise on windows we can't reopen the file in the @@ -184,7 +185,7 @@ OUString SAL_CALL SoundHandler::detect( css::uno::Sequence< css::beans::Property OUString sTypeName; // Analyze given descriptor to find filename or input stream or ... - utl::MediaDescriptor aDescriptor(lDescriptor); + comphelper::SequenceAsHashMap aDescriptor(lDescriptor); OUString sURL = aDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_URL, OUString()); OUString sReferer = aDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_REFERRER, OUString()); diff --git a/chart2/source/controller/main/ChartFrameloader.cxx b/chart2/source/controller/main/ChartFrameloader.cxx index 91e18a982cbe..693183e57e76 100644 --- a/chart2/source/controller/main/ChartFrameloader.cxx +++ b/chart2/source/controller/main/ChartFrameloader.cxx @@ -27,6 +27,7 @@ #include #include #include +#include namespace chart { @@ -81,9 +82,9 @@ sal_Bool SAL_CALL ChartFrameLoader::load( const uno::Sequence< beans::PropertyVa uno::Reference< frame::XModel > xModel; bool bHaveLoadedModel = false; - utl::MediaDescriptor aMediaDescriptor(rMediaDescriptor); + comphelper::SequenceAsHashMap aMediaDescriptor(rMediaDescriptor); { - utl::MediaDescriptor::const_iterator aIt( aMediaDescriptor.find( utl::MediaDescriptor::PROP_MODEL)); + auto aIt(aMediaDescriptor.find(utl::MediaDescriptor::PROP_MODEL)); if( aIt != aMediaDescriptor.end()) { xModel.set( (*aIt).second.get< uno::Reference< frame::XModel > >()); @@ -119,7 +120,7 @@ sal_Bool SAL_CALL ChartFrameLoader::load( const uno::Sequence< beans::PropertyVa try { - utl::MediaDescriptor::const_iterator aIt( aMediaDescriptor.find( utl::MediaDescriptor::PROP_URL)); + auto aIt(aMediaDescriptor.find(utl::MediaDescriptor::PROP_URL)); if( aIt != aMediaDescriptor.end()) { OUString aURL( (*aIt).second.get< OUString >()); @@ -136,7 +137,7 @@ sal_Bool SAL_CALL ChartFrameLoader::load( const uno::Sequence< beans::PropertyVa { aMediaDescriptor[utl::MediaDescriptor::PROP_DOCUMENTBASEURL] <<= aURL; } - aMediaDescriptor.addInputStream(); + utl::MediaDescriptor::addInputStream(aMediaDescriptor); uno::Sequence< beans::PropertyValue > aCompleteMediaDescriptor; aMediaDescriptor >> aCompleteMediaDescriptor; apphelper::MediaDescriptorHelper aMDHelper( aCompleteMediaDescriptor ); diff --git a/desktop/source/app/dispatchwatcher.cxx b/desktop/source/app/dispatchwatcher.cxx index c5adba18ebee..be3ed2d92c27 100644 --- a/desktop/source/app/dispatchwatcher.cxx +++ b/desktop/source/app/dispatchwatcher.cxx @@ -53,6 +53,7 @@ #include #include +#include #include #include #include @@ -289,7 +290,7 @@ OUString getName(const Reference< XInterface > & xDoc) Reference< XModel > xModel( xDoc, UNO_QUERY ); if (!xModel) return OUString(); - utl::MediaDescriptor aMediaDesc( xModel->getArgs() ); + comphelper::SequenceAsHashMap aMediaDesc(xModel->getArgs()); OUString aDocService = aMediaDesc.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_DOCUMENTSERVICE, OUString() ); if (aDocService == "com.sun.star.text.TextDocument") return u"Writer"_ustr; @@ -627,7 +628,7 @@ bool DispatchWatcher::executeDispatchRequests( Reference< XModel > xModel( xDoc, UNO_QUERY ); if ( xModel.is() ) { - utl::MediaDescriptor aMediaDesc( xModel->getArgs() ); + comphelper::SequenceAsHashMap aMediaDesc(xModel->getArgs()); aDocService = aMediaDesc.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_DOCUMENTSERVICE, OUString() ); } aFilter = impl_GuessFilter( aOutFile, aDocService ); diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index d65872ae8cbb..0f583fc262aa 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -3847,7 +3847,7 @@ static int doc_saveAs(LibreOfficeKitDocument* pThis, const char* sUrl, const cha std::vector aFilteredOptionVec; bool bTakeOwnership = false; bool bCreateFromTemplate = false; - MediaDescriptor aSaveMediaDescriptor; + comphelper::SequenceAsHashMap aSaveMediaDescriptor; for (const auto& rOption : aOptionSeq) { if (rOption == "TakeOwnership") @@ -5029,7 +5029,7 @@ static size_t doc_renderShapeSelection(LibreOfficeKitDocument* pThis, char** pOu SvMemoryStream aOutStream; uno::Reference xOut = new utl::OOutputStreamWrapper(aOutStream); - utl::MediaDescriptor aMediaDescriptor; + comphelper::SequenceAsHashMap aMediaDescriptor; switch (doc_getDocumentType(pThis)) { case LOK_DOCTYPE_PRESENTATION: diff --git a/embeddedobj/source/commonembedding/persistence.cxx b/embeddedobj/source/commonembedding/persistence.cxx index 0a923f88c24a..62b8fa5233b3 100644 --- a/embeddedobj/source/commonembedding/persistence.cxx +++ b/embeddedobj/source/commonembedding/persistence.cxx @@ -53,6 +53,7 @@ #include #include #include +#include #include #include #include @@ -1312,7 +1313,7 @@ void SAL_CALL OCommonEmbeddedObject::storeAsEntry( const uno::Reference< embed:: throw lang::DisposedException(); // TODO bool AutoSaveEvent = false; - utl::MediaDescriptor lArgs(lObjArgs); + comphelper::SequenceAsHashMap lArgs(lObjArgs); lArgs[utl::MediaDescriptor::PROP_AUTOSAVEEVENT] >>= AutoSaveEvent; if ( m_nObjectState == -1 ) diff --git a/filter/qa/unit/svg.cxx b/filter/qa/unit/svg.cxx index 0faa7a59922e..b2f033adcca6 100644 --- a/filter/qa/unit/svg.cxx +++ b/filter/qa/unit/svg.cxx @@ -20,9 +20,9 @@ #include #include +#include #include #include -#include #include #include @@ -201,7 +201,7 @@ CPPUNIT_TEST_FIXTURE(SvgFilterTest, testShapeNographic) uno::Reference xStorable(mxComponent, uno::UNO_QUERY_THROW); SvMemoryStream aStream; uno::Reference xOut = new utl::OOutputStreamWrapper(aStream); - utl::MediaDescriptor aMediaDescriptor; + comphelper::SequenceAsHashMap aMediaDescriptor; aMediaDescriptor[u"FilterName"_ustr] <<= u"impress_svg_Export"_ustr; aMediaDescriptor[u"OutputStream"_ustr] <<= xOut; diff --git a/filter/qa/unit/textfilterdetect.cxx b/filter/qa/unit/textfilterdetect.cxx index c47cfd91f33d..887581ce6a9d 100644 --- a/filter/qa/unit/textfilterdetect.cxx +++ b/filter/qa/unit/textfilterdetect.cxx @@ -19,10 +19,10 @@ #include #include +#include #include #include #include -#include #include #include @@ -65,7 +65,7 @@ CPPUNIT_TEST_FIXTURE(TextFilterDetectTest, testTdf114428_ignore_xml_declaration) comphelper::makePropertyValue(u"InputStream"_ustr, xStream), comphelper::makePropertyValue(u"TypeName"_ustr, u"generic_HTML"_ustr) }; xDetect->detect(aDescriptor); - utl::MediaDescriptor aMediaDesc(aDescriptor); + comphelper::SequenceAsHashMap aMediaDesc(aDescriptor); OUString aFilterName = aMediaDesc.getUnpackedValueOrDefault(u"FilterName"_ustr, OUString()); // This was empty, XML declaration caused HTML detect to not handle XHTML. CPPUNIT_ASSERT_EQUAL(u"HTML (StarWriter)"_ustr, aFilterName); @@ -266,7 +266,7 @@ CPPUNIT_TEST_FIXTURE(TextFilterDetectTest, testMarkdownDetect) comphelper::makePropertyValue(u"InputStream"_ustr, xStream), comphelper::makePropertyValue(u"TypeName"_ustr, u"generic_Markdown"_ustr) }; xDetect->detect(aDescriptor); - utl::MediaDescriptor aMediaDesc(aDescriptor); + comphelper::SequenceAsHashMap aMediaDesc(aDescriptor); OUString aFilterName = aMediaDesc.getUnpackedValueOrDefault(u"FilterName"_ustr, OUString()); CPPUNIT_ASSERT_EQUAL(u"Markdown"_ustr, aFilterName); } diff --git a/filter/source/config/cache/typedetection.cxx b/filter/source/config/cache/typedetection.cxx index 49efe1c1a9f8..0dc12b0ba884 100644 --- a/filter/source/config/cache/typedetection.cxx +++ b/filter/source/config/cache/typedetection.cxx @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -384,7 +385,7 @@ OUString SAL_CALL TypeDetection::queryTypeByDescriptor(css::uno::Sequence< css:: sal_Bool bAllowDeep ) { // make the descriptor more usable :-) - utl::MediaDescriptor stlDescriptor(lDescriptor); + comphelper::SequenceAsHashMap stlDescriptor(lDescriptor); OUString sType, sURL; try @@ -474,7 +475,7 @@ OUString SAL_CALL TypeDetection::queryTypeByDescriptor(css::uno::Sequence< css:: } -void TypeDetection::impl_checkResultsAndAddBestFilter(utl::MediaDescriptor& rDescriptor, +void TypeDetection::impl_checkResultsAndAddBestFilter(comphelper::SequenceAsHashMap& rDescriptor, OUString& sType ) { // a) @@ -770,7 +771,7 @@ OUString TypeDetection::impl_getTypeFromFilter(std::unique_lock& /*r void TypeDetection::impl_getAllFormatTypes( std::unique_lock& rGuard, - const util::URL& aParsedURL, utl::MediaDescriptor const & rDescriptor, FlatDetection& rFlatTypes) + const util::URL& aParsedURL, comphelper::SequenceAsHashMap const & rDescriptor, FlatDetection& rFlatTypes) { rFlatTypes.clear(); @@ -911,7 +912,7 @@ static bool isBrokenZIP(const css::uno::Reference& xStrea } -OUString TypeDetection::impl_detectTypeFlatAndDeep( utl::MediaDescriptor& rDescriptor , +OUString TypeDetection::impl_detectTypeFlatAndDeep(comphelper::SequenceAsHashMap& rDescriptor, const FlatDetection& lFlatTypes , bool bAllowDeep , OUString& rLastChance ) @@ -1060,7 +1061,7 @@ OUString TypeDetection::impl_detectTypeFlatAndDeep( utl::MediaDescriptor& r // <- SAFE ---------------------------------- } -void TypeDetection::impl_seekStreamToZero(utl::MediaDescriptor const & rDescriptor) +void TypeDetection::impl_seekStreamToZero(comphelper::SequenceAsHashMap const& rDescriptor) { // try to seek to 0 ... // But because XSeekable is an optional interface ... try it only .-) @@ -1085,7 +1086,7 @@ void TypeDetection::impl_seekStreamToZero(utl::MediaDescriptor const & rDescript } OUString TypeDetection::impl_askDetectService(const OUString& sDetectService, - utl::MediaDescriptor& rDescriptor ) + comphelper::SequenceAsHashMap& rDescriptor) { // Open the stream and add it to the media descriptor if this method is called for the first time. // All following requests to this method will detect, that there already exists a stream .-) @@ -1171,7 +1172,7 @@ OUString TypeDetection::impl_askDetectService(const OUString& sDet } -OUString TypeDetection::impl_askUserForTypeAndFilterIfAllowed(utl::MediaDescriptor& rDescriptor) +OUString TypeDetection::impl_askUserForTypeAndFilterIfAllowed(comphelper::SequenceAsHashMap& rDescriptor) { css::uno::Reference< css::task::XInteractionHandler > xInteraction = rDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_INTERACTIONHANDLER, @@ -1230,7 +1231,7 @@ OUString TypeDetection::impl_askUserForTypeAndFilterIfAllowed(utl::MediaDescript } -void TypeDetection::impl_openStream(utl::MediaDescriptor& rDescriptor) +void TypeDetection::impl_openStream(comphelper::SequenceAsHashMap& rDescriptor) { bool bSuccess = false; OUString sURL = rDescriptor.getUnpackedValueOrDefault( utl::MediaDescriptor::PROP_URL, OUString() ); @@ -1238,10 +1239,10 @@ void TypeDetection::impl_openStream(utl::MediaDescriptor& rDescriptor) if ( comphelper::isFileUrl( sURL ) ) { // OOo uses own file locking mechanics in case of local file - bSuccess = rDescriptor.addInputStreamOwnLock(); + bSuccess = utl::MediaDescriptor::addInputStreamOwnLock(rDescriptor); } else - bSuccess = rDescriptor.addInputStream(); + bSuccess = utl::MediaDescriptor::addInputStream(rDescriptor); if ( !bSuccess ) throw css::uno::Exception( @@ -1259,10 +1260,10 @@ void TypeDetection::impl_openStream(utl::MediaDescriptor& rDescriptor) } -void TypeDetection::impl_removeTypeFilterFromDescriptor(utl::MediaDescriptor& rDescriptor) +void TypeDetection::impl_removeTypeFilterFromDescriptor(comphelper::SequenceAsHashMap& rDescriptor) { - utl::MediaDescriptor::iterator pItType = rDescriptor.find(utl::MediaDescriptor::PROP_TYPENAME ); - utl::MediaDescriptor::iterator pItFilter = rDescriptor.find(utl::MediaDescriptor::PROP_FILTERNAME); + auto pItType = rDescriptor.find(utl::MediaDescriptor::PROP_TYPENAME); + auto pItFilter = rDescriptor.find(utl::MediaDescriptor::PROP_FILTERNAME); if (pItType != rDescriptor.end()) rDescriptor.erase(pItType); if (pItFilter != rDescriptor.end()) @@ -1270,7 +1271,7 @@ void TypeDetection::impl_removeTypeFilterFromDescriptor(utl::MediaDescriptor& rD } -bool TypeDetection::impl_validateAndSetTypeOnDescriptor( utl::MediaDescriptor& rDescriptor, +bool TypeDetection::impl_validateAndSetTypeOnDescriptor(comphelper::SequenceAsHashMap& rDescriptor, const OUString& sType ) { if (GetTheFilterCache().hasItem(FilterCache::E_TYPE, sType)) @@ -1285,7 +1286,7 @@ bool TypeDetection::impl_validateAndSetTypeOnDescriptor( utl::MediaDescript } -bool TypeDetection::impl_validateAndSetFilterOnDescriptor( utl::MediaDescriptor& rDescriptor, +bool TypeDetection::impl_validateAndSetFilterOnDescriptor( comphelper::SequenceAsHashMap& rDescriptor, const OUString& sFilter ) { try diff --git a/filter/source/config/cache/typedetection.hxx b/filter/source/config/cache/typedetection.hxx index 6ff70e64eba4..698cf7b9ada6 100644 --- a/filter/source/config/cache/typedetection.hxx +++ b/filter/source/config/cache/typedetection.hxx @@ -21,7 +21,7 @@ #include "basecontainer.hxx" #include #include -#include +#include #include #include #include @@ -85,7 +85,7 @@ private: */ static void impl_getAllFormatTypes( std::unique_lock& rGuard, - const css::util::URL& aParsedURL, utl::MediaDescriptor const & rDescriptor, + const css::util::URL& aParsedURL, comphelper::SequenceAsHashMap const & rDescriptor, FlatDetection& rFlatTypes); @@ -123,7 +123,7 @@ private: An empty value if detection failed. ... but see rLastChance for additional returns! */ - OUString impl_detectTypeFlatAndDeep( utl::MediaDescriptor& rDescriptor , + OUString impl_detectTypeFlatAndDeep(comphelper::SequenceAsHashMap& rDescriptor, const FlatDetection& lFlatTypes , bool bAllowDeep , OUString& rLastChance ); @@ -139,7 +139,7 @@ private: @param rDescriptor a stl representation of the MediaDescriptor as in/out parameter. */ - static void impl_seekStreamToZero(utl::MediaDescriptor const & rDescriptor); + static void impl_seekStreamToZero(comphelper::SequenceAsHashMap const& rDescriptor); /** @short make deep type detection for a specified @@ -160,7 +160,7 @@ private: a stl representation of the MediaDescriptor as in/out parameter. */ OUString impl_askDetectService(const OUString& sDetectService, - utl::MediaDescriptor& rDescriptor ); + comphelper::SequenceAsHashMap& rDescriptor); /** @short try to find an interaction handler and @@ -176,7 +176,7 @@ private: @return [string] a valid type name or an empty string if user canceled interaction. */ - static OUString impl_askUserForTypeAndFilterIfAllowed(utl::MediaDescriptor& rDescriptor); + static OUString impl_askUserForTypeAndFilterIfAllowed(comphelper::SequenceAsHashMap& rDescriptor); /** @short check if an input stream is already part of the @@ -212,7 +212,7 @@ private: Note: If an interactionHandler is part of the given descriptor too, it was already used. Means: let the exception pass through the top most interface method! */ - void impl_openStream(utl::MediaDescriptor& rDescriptor); + void impl_openStream(comphelper::SequenceAsHashMap& rDescriptor); /** @short validate the specified type and its relationships @@ -233,7 +233,7 @@ private: @return TRUE the specified type and its registrations was valid(!) and could be set on the descriptor. */ - static bool impl_validateAndSetTypeOnDescriptor( utl::MediaDescriptor& rDescriptor, + static bool impl_validateAndSetTypeOnDescriptor(comphelper::SequenceAsHashMap& rDescriptor, const OUString& sType ); @@ -254,8 +254,7 @@ private: @return TRUE the specified type and its registrations was valid(!) and could be set on the descriptor. */ - static bool impl_validateAndSetFilterOnDescriptor( - utl::MediaDescriptor& rDescriptor, + static bool impl_validateAndSetFilterOnDescriptor(comphelper::SequenceAsHashMap& rDescriptor, const OUString& sFilter ); @@ -270,7 +269,7 @@ private: reference to the MediaDescriptor (represented by an easy-to-use stl interface!), which should be patched. */ - static void impl_removeTypeFilterFromDescriptor(utl::MediaDescriptor& rDescriptor); + static void impl_removeTypeFilterFromDescriptor(comphelper::SequenceAsHashMap& rDescriptor); /** @short search the best suitable filter for the given type @@ -303,7 +302,7 @@ private: rDescriptor will be changed by selecting another filter. (see code) */ - void impl_checkResultsAndAddBestFilter(utl::MediaDescriptor& rDescriptor, + void impl_checkResultsAndAddBestFilter(comphelper::SequenceAsHashMap& rDescriptor, OUString& sType ); diff --git a/filter/source/storagefilterdetect/filterdetect.cxx b/filter/source/storagefilterdetect/filterdetect.cxx index cc4c8950d35f..02e5e249667e 100644 --- a/filter/source/storagefilterdetect/filterdetect.cxx +++ b/filter/source/storagefilterdetect/filterdetect.cxx @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -36,7 +37,6 @@ #include using namespace ::com::sun::star; -using utl::MediaDescriptor; namespace { @@ -85,12 +85,12 @@ StorageFilterDetect::~StorageFilterDetect() {} OUString SAL_CALL StorageFilterDetect::detect(uno::Sequence& rDescriptor) { - MediaDescriptor aMediaDesc( rDescriptor ); + comphelper::SequenceAsHashMap aMediaDesc(rDescriptor); OUString aTypeName; try { - uno::Reference< io::XInputStream > xInStream( aMediaDesc[MediaDescriptor::PROP_INPUTSTREAM], uno::UNO_QUERY ); + uno::Reference< io::XInputStream > xInStream( aMediaDesc[utl::MediaDescriptor::PROP_INPUTSTREAM], uno::UNO_QUERY ); if ( !xInStream.is() ) return OUString(); @@ -117,12 +117,12 @@ OUString SAL_CALL StorageFilterDetect::detect(uno::Sequence>= aZipException ) && !aRequestedTypeName.isEmpty() ) { // The package is a broken one. INetURLObject aParser( - aMediaDesc.getUnpackedValueOrDefault(MediaDescriptor::PROP_URL, OUString())); + aMediaDesc.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_URL, OUString())); OUString aDocumentTitle = aParser.getName(INetURLObject::LAST_SEGMENT, true, INetURLObject::DecodeMechanism::WithCharset); bool bRepairPackage = aMediaDesc.getUnpackedValueOrDefault(u"RepairPackage"_ustr, false); @@ -130,7 +130,7 @@ OUString SAL_CALL StorageFilterDetect::detect(uno::Sequence xInteraction = - aMediaDesc.getUnpackedValueOrDefault( MediaDescriptor::PROP_INTERACTIONHANDLER, uno::Reference< task::XInteractionHandler >() ); + aMediaDesc.getUnpackedValueOrDefault( utl::MediaDescriptor::PROP_INTERACTIONHANDLER, uno::Reference< task::XInteractionHandler >() ); if ( xInteraction.is() ) { @@ -152,8 +152,8 @@ OUString SAL_CALL StorageFilterDetect::detect(uno::Sequence #include #include +#include #include #include @@ -218,7 +219,7 @@ bool SVGFilter::filterImpressOrDraw( const Sequence< PropertyValue >& rDescripto { // Import. // use MediaDescriptor to get needed data out of Sequence< PropertyValue > - utl::MediaDescriptor aMediaDescriptor(rDescriptor); + comphelper::SequenceAsHashMap aMediaDescriptor(rDescriptor); uno::Reference xInputStream; xInputStream.set(aMediaDescriptor[utl::MediaDescriptor::PROP_INPUTSTREAM], UNO_QUERY); @@ -774,7 +775,7 @@ public: OUString SAL_CALL SVGFilter::detect(Sequence& rDescriptor) { - utl::MediaDescriptor aMediaDescriptor(rDescriptor); + comphelper::SequenceAsHashMap aMediaDescriptor(rDescriptor); uno::Reference xInput(aMediaDescriptor[utl::MediaDescriptor::PROP_INPUTSTREAM], UNO_QUERY); OUString aRetval; diff --git a/filter/source/textfilterdetect/filterdetect.cxx b/filter/source/textfilterdetect/filterdetect.cxx index 7162933178a1..da606db92ffe 100644 --- a/filter/source/textfilterdetect/filterdetect.cxx +++ b/filter/source/textfilterdetect/filterdetect.cxx @@ -9,6 +9,7 @@ #include "filterdetect.hxx" +#include #include #include #include @@ -34,7 +35,6 @@ constexpr OUString WRITER_DOCSERVICE = u"com.sun.star.text.TextDocument"_ustr; constexpr OUString CALC_DOCSERVICE = u"com.sun.star.sheet.SpreadsheetDocument"_ustr; using namespace ::com::sun::star; -using utl::MediaDescriptor; namespace { @@ -137,45 +137,45 @@ PlainTextFilterDetect::~PlainTextFilterDetect() {} OUString SAL_CALL PlainTextFilterDetect::detect(uno::Sequence& lDescriptor) { - MediaDescriptor aMediaDesc(lDescriptor); + comphelper::SequenceAsHashMap aMediaDesc(lDescriptor); - OUString aType = aMediaDesc.getUnpackedValueOrDefault(MediaDescriptor::PROP_TYPENAME, OUString() ); - OUString aDocService = aMediaDesc.getUnpackedValueOrDefault(MediaDescriptor::PROP_DOCUMENTSERVICE, OUString() ); + OUString aType = aMediaDesc.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_TYPENAME, OUString() ); + OUString aDocService = aMediaDesc.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_DOCUMENTSERVICE, OUString() ); if ((aType == "generic_HTML") || (aType == "calc_HTML")) { - uno::Reference xInStream(aMediaDesc[MediaDescriptor::PROP_INPUTSTREAM], uno::UNO_QUERY); + uno::Reference xInStream(aMediaDesc[utl::MediaDescriptor::PROP_INPUTSTREAM], uno::UNO_QUERY); if (!xInStream.is() || !IsHTMLStream(xInStream)) return OUString(); if ((aDocService == CALC_DOCSERVICE) || (aType == "calc_HTML")) - aMediaDesc[MediaDescriptor::PROP_FILTERNAME] <<= OUString(CALC_HTML_FILTER); + aMediaDesc[utl::MediaDescriptor::PROP_FILTERNAME] <<= OUString(CALC_HTML_FILTER); else if (aDocService == WRITER_DOCSERVICE) - aMediaDesc[MediaDescriptor::PROP_FILTERNAME] <<= OUString(WRITER_HTML_FILTER); + aMediaDesc[utl::MediaDescriptor::PROP_FILTERNAME] <<= OUString(WRITER_HTML_FILTER); else - aMediaDesc[MediaDescriptor::PROP_FILTERNAME] <<= OUString(WEB_HTML_FILTER); + aMediaDesc[utl::MediaDescriptor::PROP_FILTERNAME] <<= OUString(WEB_HTML_FILTER); } else if(aType == "generic_Markdown") { - uno::Reference xInStream(aMediaDesc[MediaDescriptor::PROP_INPUTSTREAM], uno::UNO_QUERY); + uno::Reference xInStream(aMediaDesc[utl::MediaDescriptor::PROP_INPUTSTREAM], uno::UNO_QUERY); if (!xInStream.is()) return OUString(); - INetURLObject aParser(aMediaDesc.getUnpackedValueOrDefault(MediaDescriptor::PROP_URL, OUString() ) ); + INetURLObject aParser(aMediaDesc.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_URL, OUString() ) ); OUString aExt = aParser.getExtension(INetURLObject::LAST_SEGMENT, true, INetURLObject::DecodeMechanism::WithCharset); aExt = aExt.toAsciiLowerCase(); if(aDocService == WRITER_DOCSERVICE) - aMediaDesc[MediaDescriptor::PROP_FILTERNAME] <<= WRITER_MARKDOWN_FILTER; + aMediaDesc[utl::MediaDescriptor::PROP_FILTERNAME] <<= WRITER_MARKDOWN_FILTER; else if(aExt == "md" || aExt == "markdown") - aMediaDesc[MediaDescriptor::PROP_FILTERNAME] <<= WRITER_MARKDOWN_FILTER; + aMediaDesc[utl::MediaDescriptor::PROP_FILTERNAME] <<= WRITER_MARKDOWN_FILTER; else return OUString(); } else if (aType == "generic_Text") { - uno::Reference xStream(aMediaDesc[MediaDescriptor::PROP_STREAM], uno::UNO_QUERY); - uno::Reference xInStream(aMediaDesc[MediaDescriptor::PROP_INPUTSTREAM], uno::UNO_QUERY); + uno::Reference xStream(aMediaDesc[utl::MediaDescriptor::PROP_STREAM], uno::UNO_QUERY); + uno::Reference xInStream(aMediaDesc[utl::MediaDescriptor::PROP_INPUTSTREAM], uno::UNO_QUERY); if (xStream.is() || xInStream.is()) { ZCodec aCodecGZ; @@ -188,16 +188,16 @@ OUString SAL_CALL PlainTextFilterDetect::detect(uno::Sequence xStreamDecompressed(new utl::OStreamWrapper(std::move(pDecompressedStream))); - aMediaDesc[MediaDescriptor::PROP_STREAM] <<= xStreamDecompressed; - aMediaDesc[MediaDescriptor::PROP_INPUTSTREAM] <<= xStreamDecompressed->getInputStream(); - OUString aURL = aMediaDesc.getUnpackedValueOrDefault(MediaDescriptor::PROP_URL, OUString() ); + aMediaDesc[utl::MediaDescriptor::PROP_STREAM] <<= xStreamDecompressed; + aMediaDesc[utl::MediaDescriptor::PROP_INPUTSTREAM] <<= xStreamDecompressed->getInputStream(); + OUString aURL = aMediaDesc.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_URL, OUString() ); sal_Int32 nIdx = aURL.lastIndexOf(".gz"); if (nIdx != -1) - aMediaDesc[MediaDescriptor::PROP_URL] <<= aURL.copy(0, nIdx); + aMediaDesc[utl::MediaDescriptor::PROP_URL] <<= aURL.copy(0, nIdx); } } // Get the file name extension. - INetURLObject aParser(aMediaDesc.getUnpackedValueOrDefault(MediaDescriptor::PROP_URL, OUString() ) ); + INetURLObject aParser(aMediaDesc.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_URL, OUString() ) ); OUString aExt = aParser.getExtension(INetURLObject::LAST_SEGMENT, true, INetURLObject::DecodeMechanism::WithCharset); aExt = aExt.toAsciiLowerCase(); OUString aName = aParser.getName().toAsciiLowerCase(); @@ -206,13 +206,13 @@ OUString SAL_CALL PlainTextFilterDetect::detect(uno::Sequence& const OUString sXMLImportService = msUserData[2]; sal_Int32 nSteps= 0; - utl::MediaDescriptor aMediaMap(aDescriptor); + comphelper::SequenceAsHashMap aMediaMap(aDescriptor); Reference< XStatusIndicator > xStatusIndicator(aMediaMap.getUnpackedValueOrDefault( utl::MediaDescriptor::PROP_STATUSINDICATOR, Reference< XStatusIndicator >())); @@ -228,7 +228,7 @@ bool XmlFilterAdaptor::exportImpl( const Sequence< css::beans::PropertyValue >& // Status Bar sal_Int32 nSteps= 1; - utl::MediaDescriptor aMediaMap(aDescriptor); + comphelper::SequenceAsHashMap aMediaMap(aDescriptor); Reference< XStatusIndicator > xStatusIndicator(aMediaMap.getUnpackedValueOrDefault( utl::MediaDescriptor::PROP_STATUSINDICATOR, Reference< XStatusIndicator >())); diff --git a/framework/inc/classes/taskcreator.hxx b/framework/inc/classes/taskcreator.hxx index d57cc406e3b7..5b8e7a335124 100644 --- a/framework/inc/classes/taskcreator.hxx +++ b/framework/inc/classes/taskcreator.hxx @@ -24,7 +24,7 @@ #include #include -#include +#include namespace framework{ @@ -51,7 +51,7 @@ class TaskCreator final TaskCreator( css::uno::Reference< css::uno::XComponentContext > xContext ); ~TaskCreator( ); - css::uno::Reference< css::frame::XFrame > createTask( const OUString& sName, const utl::MediaDescriptor& rDescriptor ); + css::uno::Reference< css::frame::XFrame > createTask( const OUString& sName, const comphelper::SequenceAsHashMap& rDescriptor ); }; // class TaskCreator diff --git a/framework/source/classes/taskcreator.cxx b/framework/source/classes/taskcreator.cxx index 167e345e051e..c9732d054cb8 100644 --- a/framework/source/classes/taskcreator.cxx +++ b/framework/source/classes/taskcreator.cxx @@ -26,6 +26,9 @@ #include #include #include + +#include + #include namespace framework{ @@ -54,7 +57,7 @@ TaskCreator::~TaskCreator() /*-**************************************************************************************************** TODO document me *//*-*****************************************************************************************************/ -css::uno::Reference< css::frame::XFrame > TaskCreator::createTask( const OUString& sName, const utl::MediaDescriptor& rDescriptor ) +css::uno::Reference< css::frame::XFrame > TaskCreator::createTask( const OUString& sName, const comphelper::SequenceAsHashMap& rDescriptor ) { rtl::Reference< TaskCreatorService > xCreator = new TaskCreatorService(m_xContext); diff --git a/framework/source/dispatch/oxt_handler.cxx b/framework/source/dispatch/oxt_handler.cxx index 7d38224e4329..de47f9383b19 100644 --- a/framework/source/dispatch/oxt_handler.cxx +++ b/framework/source/dispatch/oxt_handler.cxx @@ -18,6 +18,8 @@ */ #include + +#include #include #include @@ -142,7 +144,7 @@ OUString SAL_CALL Oxt_Handler::detect( css::uno::Sequence< css::beans::PropertyV OUString sTypeName; // Analyze given descriptor to find filename or input stream or... - utl::MediaDescriptor aDescriptor( lDescriptor ); + comphelper::SequenceAsHashMap aDescriptor(lDescriptor); OUString sURL = aDescriptor.getUnpackedValueOrDefault( utl::MediaDescriptor::PROP_URL, OUString() ); tools::Long nLength = sURL.getLength(); diff --git a/framework/source/fwe/helper/titlehelper.cxx b/framework/source/fwe/helper/titlehelper.cxx index 422982ea629e..f2fa4bbb5482 100644 --- a/framework/source/fwe/helper/titlehelper.cxx +++ b/framework/source/fwe/helper/titlehelper.cxx @@ -341,7 +341,7 @@ void TitleHelper::impl_updateTitleForModel (const css::uno::Reference< css::fram OUString sTitle; - utl::MediaDescriptor aDescriptor( + comphelper::SequenceAsHashMap aDescriptor( xModel->getArgs2({ utl::MediaDescriptor::PROP_DOCUMENTTITLE, utl::MediaDescriptor::PROP_SUGGESTEDSAVEASNAME })); diff --git a/framework/source/helper/statusindicatorfactory.cxx b/framework/source/helper/statusindicatorfactory.cxx index 4787e48865bd..8351f1921667 100644 --- a/framework/source/helper/statusindicatorfactory.cxx +++ b/framework/source/helper/statusindicatorfactory.cxx @@ -365,7 +365,7 @@ void StatusIndicatorFactory::implts_makeParentVisibleIfAllowed() xModel = xController->getModel(); if (xModel.is()) { - utl::MediaDescriptor lDocArgs(xModel->getArgs()); + comphelper::SequenceAsHashMap lDocArgs(xModel->getArgs()); bHiddenDoc = lDocArgs.getUnpackedValueOrDefault( utl::MediaDescriptor::PROP_HIDDEN, false); diff --git a/framework/source/inc/loadenv/loadenv.hxx b/framework/source/inc/loadenv/loadenv.hxx index 3fba486c8161..38bfab20e393 100644 --- a/framework/source/inc/loadenv/loadenv.hxx +++ b/framework/source/inc/loadenv/loadenv.hxx @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include @@ -139,7 +139,7 @@ private: @descr Inside this struct e.g. the URL, its type and filter name, the stream or a model directly are saved. */ - utl::MediaDescriptor m_lMediaDescriptor; + comphelper::SequenceAsHashMap m_lMediaDescriptor; /** @short because the mediadescriptor contains the complete URL ... but some functionality need the structured version, we hold it twice :-(. @@ -338,7 +338,7 @@ public: /** TODO document me ... */ static void initializeUIDefaults( const css::uno::Reference< css::uno::XComponentContext >& i_rxContext, - utl::MediaDescriptor& io_lMediaDescriptor, + comphelper::SequenceAsHashMap& io_lMediaDescriptor, const bool _bUIMode, rtl::Reference* o_ppQuiteInteraction ); diff --git a/framework/source/layoutmanager/helpers.cxx b/framework/source/layoutmanager/helpers.cxx index 6592b9b48d31..869526c921cf 100644 --- a/framework/source/layoutmanager/helpers.cxx +++ b/framework/source/layoutmanager/helpers.cxx @@ -30,6 +30,7 @@ #include #include +#include #include #include #include @@ -262,7 +263,7 @@ bool implts_isPreviewModel( const uno::Reference< frame::XModel >& xModel ) if ( xModel.is() ) { - utl::MediaDescriptor aDesc( xModel->getArgs() ); + comphelper::SequenceAsHashMap aDesc(xModel->getArgs()); return aDesc.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_PREVIEW, false); } else diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx index 36c26f961194..d2008b7afff3 100644 --- a/framework/source/loadenv/loadenv.cxx +++ b/framework/source/loadenv/loadenv.cxx @@ -92,6 +92,7 @@ #include #include #include +#include constexpr OUString PROP_TYPES = u"Types"_ustr; constexpr OUString PROP_NAME = u"Name"_ustr; @@ -214,15 +215,15 @@ css::uno::Reference< css::lang::XComponent > LoadEnv::loadComponentFromURL(const namespace { -utl::MediaDescriptor addModelArgs(const uno::Sequence& rDescriptor) +comphelper::SequenceAsHashMap addModelArgs(const uno::Sequence& rDescriptor) { - utl::MediaDescriptor rResult(rDescriptor); + comphelper::SequenceAsHashMap rResult(rDescriptor); uno::Reference xModel(rResult.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_MODEL, uno::Reference())); if (xModel.is()) { - utl::MediaDescriptor aModelArgs(xModel->getArgs()); - utl::MediaDescriptor::iterator pIt = aModelArgs.find( utl::MediaDescriptor::PROP_MACROEXECUTIONMODE); + comphelper::SequenceAsHashMap aModelArgs(xModel->getArgs()); + auto pIt = aModelArgs.find(utl::MediaDescriptor::PROP_MACROEXECUTIONMODE); if (pIt != aModelArgs.end()) rResult[utl::MediaDescriptor::PROP_MACROEXECUTIONMODE] = pIt->second; } @@ -283,7 +284,7 @@ void LoadEnv::startLoading(const OUString& sURL, const uno::Sequence& i_rxContext, - utl::MediaDescriptor& io_lMediaDescriptor, const bool i_bUIMode, + comphelper::SequenceAsHashMap& io_lMediaDescriptor, const bool i_bUIMode, rtl::Reference* o_ppQuietInteraction ) { css::uno::Reference< css::task::XInteractionHandler > xInteractionHandler; @@ -591,11 +592,10 @@ LoadEnv::EContentType LoadEnv::classifyContent(const OUString& return E_CAN_BE_LOADED; // using of an existing input stream - utl::MediaDescriptor stlMediaDescriptor(lMediaDescriptor); - utl::MediaDescriptor::const_iterator pIt; + comphelper::SequenceAsHashMap stlMediaDescriptor(lMediaDescriptor); if (ProtocolCheck::isProtocol(sURL,EProtocol::PrivateStream)) { - pIt = stlMediaDescriptor.find(utl::MediaDescriptor::PROP_INPUTSTREAM); + auto pIt = stlMediaDescriptor.find(utl::MediaDescriptor::PROP_INPUTSTREAM); css::uno::Reference< css::io::XInputStream > xStream; if (pIt != stlMediaDescriptor.end()) pIt->second >>= xStream; @@ -608,7 +608,7 @@ LoadEnv::EContentType LoadEnv::classifyContent(const OUString& // using of a full featured document if (ProtocolCheck::isProtocol(sURL,EProtocol::PrivateObject)) { - pIt = stlMediaDescriptor.find(utl::MediaDescriptor::PROP_MODEL); + auto pIt = stlMediaDescriptor.find(utl::MediaDescriptor::PROP_MODEL); css::uno::Reference< css::frame::XModel > xModel; if (pIt != stlMediaDescriptor.end()) pIt->second >>= xModel; @@ -855,7 +855,7 @@ void LoadEnv::impl_detectTypeAndFilter() // SAFE -> aWriteLock.reset(); // Don't overwrite external decisions! See comments before ... - utl::MediaDescriptor::const_iterator pAsTemplateItem = m_lMediaDescriptor.find(utl::MediaDescriptor::PROP_ASTEMPLATE); + auto pAsTemplateItem = m_lMediaDescriptor.find(utl::MediaDescriptor::PROP_ASTEMPLATE); if (pAsTemplateItem == m_lMediaDescriptor.end()) m_lMediaDescriptor[utl::MediaDescriptor::PROP_ASTEMPLATE] <<= true; aWriteLock.clear(); @@ -1385,7 +1385,7 @@ css::uno::Reference< css::frame::XFrame > LoadEnv::impl_searchAlreadyLoaded() // and decide if it's really the same then the one will be. // It must be visible and must use the same file revision ... // or must not have any file revision set (-1 == -1!) - utl::MediaDescriptor lOldDocDescriptor; + comphelper::SequenceAsHashMap lOldDocDescriptor; if (xModel.is()) { lOldDocDescriptor = xModel->getArgs(); @@ -1572,7 +1572,7 @@ css::uno::Reference< css::frame::XFrame > LoadEnv::impl_searchRecycleTarget() css::uno::Reference< css::frame::XController > xOldDoc = xTask->getController(); if (xOldDoc.is()) { - utl::MediaDescriptor lOldDocDescriptor(xModel->getArgs()); + comphelper::SequenceAsHashMap lOldDocDescriptor(xModel->getArgs()); // replaceable document if (!lOldDocDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_REPLACEABLE, false)) @@ -1637,7 +1637,7 @@ void LoadEnv::impl_reactForLoadingState() // Note: Only if an existing property "FrameName" is given by this media descriptor, // it should be used. Otherwise we should do nothing. May be the outside code has already // set a frame name on the target! - utl::MediaDescriptor::const_iterator pFrameName = m_lMediaDescriptor.find(utl::MediaDescriptor::PROP_FRAMENAME); + auto pFrameName = m_lMediaDescriptor.find(utl::MediaDescriptor::PROP_FRAMENAME); if (pFrameName != m_lMediaDescriptor.end()) { OUString sFrameName; diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx index 23076630e455..5182f1461b5e 100644 --- a/framework/source/services/autorecovery.cxx +++ b/framework/source/services/autorecovery.cxx @@ -831,12 +831,12 @@ private: // TODO document me void implts_openOneDoc(const OUString& sURL , - utl::MediaDescriptor& lDescriptor, + comphelper::SequenceAsHashMap& lDescriptor, AutoRecovery::TDocumentInfo& rInfo ); // TODO document me void implts_generateNewTempURL(const OUString& sBackupPath , - utl::MediaDescriptor& rMediaDescriptor, + comphelper::SequenceAsHashMap& rMediaDescriptor, AutoRecovery::TDocumentInfo& rInfo ); /** @short notifies all interested listener about the current state @@ -1016,11 +1016,11 @@ private: is used to set the new created progress as parameter on these set. */ static void impl_establishProgress(const AutoRecovery::TDocumentInfo& rInfo , - utl::MediaDescriptor& rArgs , + comphelper::SequenceAsHashMap& rArgs, const css::uno::Reference< css::frame::XFrame >& xNewFrame); static void impl_forgetProgress(const AutoRecovery::TDocumentInfo& rInfo , - utl::MediaDescriptor& rArgs , + comphelper::SequenceAsHashMap& rArgs, const css::uno::Reference< css::frame::XFrame >& xNewFrame); /** try to remove the specified file from disc. @@ -2466,7 +2466,7 @@ void AutoRecovery::implts_registerDocument(const css::uno::Reference< css::frame aCacheLock.unlock(); - utl::MediaDescriptor lDescriptor(xDocument->getArgs2( { utl::MediaDescriptor::PROP_FILTERNAME, utl::MediaDescriptor::PROP_NOAUTOSAVE } )); + comphelper::SequenceAsHashMap lDescriptor(xDocument->getArgs2( { utl::MediaDescriptor::PROP_FILTERNAME, utl::MediaDescriptor::PROP_NOAUTOSAVE } )); // check if this document must be ignored for recovery ! // Some use cases don't wish support for AutoSave/Recovery ... as e.g. OLE-Server / ActiveX Control etcpp. @@ -2716,7 +2716,7 @@ void AutoRecovery::implts_markDocumentAsSaved(const css::uno::Reference< css::fr aInfo.OldTempURL.clear(); aInfo.NewTempURL.clear(); - utl::MediaDescriptor lDescriptor(aInfo.Document->getArgs()); + comphelper::SequenceAsHashMap lDescriptor(aInfo.Document->getArgs()); aInfo.RealFilter = lDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_FILTERNAME, OUString()); css::uno::Reference< css::frame::XTitle > xDocTitle(xDocument, css::uno::UNO_QUERY); @@ -2886,7 +2886,7 @@ bool lc_checkIfSaveForbiddenByArguments(AutoRecovery::TDocumentInfo const & rInf if (! rInfo.Document.is()) return true; - utl::MediaDescriptor lDescriptor(rInfo.Document->getArgs()); + comphelper::SequenceAsHashMap lDescriptor(rInfo.Document->getArgs()); bool bNoAutoSave = lDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_NOAUTOSAVE, false); return bNoAutoSave; @@ -3080,12 +3080,12 @@ void AutoRecovery::implts_saveOneDoc(const OUString& if (!rInfo.Document.is()) return; - utl::MediaDescriptor lOldArgs(rInfo.Document->getArgs()); + comphelper::SequenceAsHashMap lOldArgs(rInfo.Document->getArgs()); implts_generateNewTempURL(sBackupPath, lOldArgs, rInfo); // if the document was loaded with a password, it should be // stored with password - utl::MediaDescriptor lNewArgs; + comphelper::SequenceAsHashMap lNewArgs; css::uno::Sequence< css::beans::NamedValue > aEncryptionData = lOldArgs.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_ENCRYPTIONDATA, css::uno::Sequence< css::beans::NamedValue >()); @@ -3287,7 +3287,7 @@ AutoRecovery::ETimerType AutoRecovery::implts_openDocs(const DispatchParams& aPa continue; } - utl::MediaDescriptor lDescriptor; + comphelper::SequenceAsHashMap lDescriptor; // it's a UI feature - so the "USER" itself must be set as referrer lDescriptor[utl::MediaDescriptor::PROP_REFERRER] <<= OUString(REFERRER_USER); @@ -3399,7 +3399,7 @@ AutoRecovery::ETimerType AutoRecovery::implts_openDocs(const DispatchParams& aPa if (!info.RealFilter.isEmpty()) { - utl::MediaDescriptor lPatchDescriptor(info.Document->getArgs()); + comphelper::SequenceAsHashMap lPatchDescriptor(info.Document->getArgs()); lPatchDescriptor[utl::MediaDescriptor::PROP_FILTERNAME] <<= info.RealFilter; info.Document->attachResource(info.Document->getURL(), lPatchDescriptor.getAsConstPropertyValueList()); // do *not* use sURL here. In case this points to the recovery file, it has already been passed @@ -3443,7 +3443,7 @@ AutoRecovery::ETimerType AutoRecovery::implts_openDocs(const DispatchParams& aPa } void AutoRecovery::implts_openOneDoc(const OUString& sURL , - utl::MediaDescriptor& lDescriptor, + comphelper::SequenceAsHashMap& lDescriptor, AutoRecovery::TDocumentInfo& rInfo ) { css::uno::Reference< css::frame::XDesktop2 > xDesktop = css::frame::Desktop::create(m_xContext); @@ -3578,7 +3578,7 @@ void AutoRecovery::implts_openOneDoc(const OUString& sURL , } void AutoRecovery::implts_generateNewTempURL(const OUString& sBackupPath , - utl::MediaDescriptor& /*rMediaDescriptor*/, + comphelper::SequenceAsHashMap& /*rMediaDescriptor*/, AutoRecovery::TDocumentInfo& rInfo ) { // specify URL for saving (which points to a temp file inside backup directory) @@ -4192,7 +4192,7 @@ void AutoRecovery::impl_showFullDiscError() // static void AutoRecovery::impl_establishProgress(const AutoRecovery::TDocumentInfo& rInfo , - utl::MediaDescriptor& rArgs , + comphelper::SequenceAsHashMap& rArgs, const css::uno::Reference< css::frame::XFrame >& xNewFrame) { // external well known frame must be preferred (because it was created by ourself @@ -4258,7 +4258,7 @@ void AutoRecovery::impl_establishProgress(const AutoRecovery::TDocumentInfo& // static void AutoRecovery::impl_forgetProgress(const AutoRecovery::TDocumentInfo& rInfo , - utl::MediaDescriptor& rArgs , + comphelper::SequenceAsHashMap& rArgs, const css::uno::Reference< css::frame::XFrame >& xNewFrame) { // external well known frame must be preferred (because it was created by ourself @@ -4283,7 +4283,7 @@ void AutoRecovery::impl_forgetProgress(const AutoRecovery::TDocumentInfo& xFrameProps->setPropertyValue(FramePropNames[FramePropHandle::IndicatorInterception], css::uno::Any(css::uno::Reference< css::task::XStatusIndicator >())); // forget progress inside list of arguments. - utl::MediaDescriptor::iterator pArg = rArgs.find(utl::MediaDescriptor::PROP_STATUSINDICATOR); + auto pArg = rArgs.find(utl::MediaDescriptor::PROP_STATUSINDICATOR); if (pArg != rArgs.end()) { rArgs.erase(pArg); diff --git a/framework/source/services/desktop.cxx b/framework/source/services/desktop.cxx index 49115c708172..fc015370a551 100644 --- a/framework/source/services/desktop.cxx +++ b/framework/source/services/desktop.cxx @@ -574,7 +574,7 @@ css::uno::Reference< css::lang::XComponent > SAL_CALL Desktop::loadComponentFrom css::uno::Reference< css::frame::XComponentLoader > xThis(this); - utl::MediaDescriptor aDescriptor(lArguments); + comphelper::SequenceAsHashMap aDescriptor(lArguments); bool bOnMainThread = aDescriptor.getUnpackedValueOrDefault(u"OnMainThread"_ustr, false); if (bOnMainThread) @@ -943,7 +943,7 @@ css::uno::Reference< css::frame::XFrame > SAL_CALL Desktop::findFrame( const OUS if ( sTargetFrameName==SPECIALTARGET_BLANK ) { TaskCreator aCreator( m_xContext ); - xTarget = aCreator.createTask(sTargetFrameName, utl::MediaDescriptor()); + xTarget = aCreator.createTask(sTargetFrameName, {}); } // I.II) "_top" @@ -1027,7 +1027,7 @@ css::uno::Reference< css::frame::XFrame > SAL_CALL Desktop::findFrame( const OUS ) { TaskCreator aCreator( m_xContext ); - xTarget = aCreator.createTask(sTargetFrameName, utl::MediaDescriptor()); + xTarget = aCreator.createTask(sTargetFrameName, {}); } } diff --git a/framework/source/services/dispatchhelper.cxx b/framework/source/services/dispatchhelper.cxx index b743e5b5ba4d..32854d7a37c1 100644 --- a/framework/source/services/dispatchhelper.cxx +++ b/framework/source/services/dispatchhelper.cxx @@ -24,7 +24,7 @@ #include #include -#include +#include #include #include #include @@ -109,7 +109,7 @@ css::uno::Any SAL_CALL DispatchHelper::executeDispatch( css::uno::Reference xDispatch = xDispatchProvider->queryDispatch(aURL, sTargetFrameName, nSearchFlags); - utl::MediaDescriptor aDescriptor(lArguments); + comphelper::SequenceAsHashMap aDescriptor(lArguments); bool bOnMainThread = aDescriptor.getUnpackedValueOrDefault(u"OnMainThread"_ustr, false); if (bOnMainThread) diff --git a/framework/source/services/frame.cxx b/framework/source/services/frame.cxx index 441b25b57bef..0ab73de39035 100644 --- a/framework/source/services/frame.cxx +++ b/framework/source/services/frame.cxx @@ -573,7 +573,7 @@ css::uno::Reference< css::lang::XComponent > SAL_CALL XFrameImpl::loadComponentF css::uno::Reference< css::frame::XComponentLoader > xThis(this); - utl::MediaDescriptor aDescriptor(lArguments); + comphelper::SequenceAsHashMap aDescriptor(lArguments); bool bOnMainThread = aDescriptor.getUnpackedValueOrDefault(u"OnMainThread"_ustr, false); if (bOnMainThread) @@ -981,7 +981,7 @@ css::uno::Reference< css::frame::XFrame > SAL_CALL XFrameImpl::findFrame( const if ( sTargetFrameName==SPECIALTARGET_BLANK ) { TaskCreator aCreator(m_xContext); - xTarget = aCreator.createTask(sTargetFrameName, utl::MediaDescriptor()); + xTarget = aCreator.createTask(sTargetFrameName, {}); } // I.II) "_parent" @@ -1180,7 +1180,7 @@ css::uno::Reference< css::frame::XFrame > SAL_CALL XFrameImpl::findFrame( const ) { TaskCreator aCreator(m_xContext); - xTarget = aCreator.createTask(sTargetFrameName, utl::MediaDescriptor()); + xTarget = aCreator.createTask(sTargetFrameName, {}); } } diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx index 701c31f7f561..a773c617ef4c 100644 --- a/framework/source/uielement/toolbarmanager.cxx +++ b/framework/source/uielement/toolbarmanager.cxx @@ -61,6 +61,7 @@ #include #include #include +#include #include #include #include @@ -1805,7 +1806,7 @@ bool ToolBarManager::IsPluginMode() const if ( xModel.is() ) { Sequence< PropertyValue > aSeq = xModel->getArgs(); - utl::MediaDescriptor aMediaDescriptor( aSeq ); + comphelper::SequenceAsHashMap aMediaDescriptor(aSeq); bPluginMode = aMediaDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_VIEWONLY, false ); } } diff --git a/hwpfilter/source/hwpreader.cxx b/hwpfilter/source/hwpreader.cxx index 121183d4e7a2..ae507b62c4ce 100644 --- a/hwpfilter/source/hwpreader.cxx +++ b/hwpfilter/source/hwpreader.cxx @@ -31,6 +31,7 @@ #include #include #include +#include #include "fontmap.hxx" #include "formula.h" @@ -161,8 +162,8 @@ bool HwpReader::importHStream(std::unique_ptr stream) sal_Bool HwpReader::filter(const Sequence< PropertyValue >& rDescriptor) { - utl::MediaDescriptor aDescriptor(rDescriptor); - aDescriptor.addInputStream(); + comphelper::SequenceAsHashMap aDescriptor(rDescriptor); + utl::MediaDescriptor::addInputStream(aDescriptor); Reference< XInputStream > xInputStream( aDescriptor[utl::MediaDescriptor::PROP_INPUTSTREAM], UNO_QUERY_THROW); @@ -4803,8 +4804,8 @@ OUString HwpImportFilter::detect( css::uno::Sequence< css::beans::PropertyValue { OUString sTypeName; - utl::MediaDescriptor aDescriptor(rDescriptor); - aDescriptor.addInputStream(); + comphelper::SequenceAsHashMap aDescriptor(rDescriptor); + utl::MediaDescriptor::addInputStream(aDescriptor); Reference< XInputStream > xInputStream( aDescriptor[utl::MediaDescriptor::PROP_INPUTSTREAM], UNO_QUERY); diff --git a/include/oox/core/filterbase.hxx b/include/oox/core/filterbase.hxx index b080fe5e2238..73af247ae6a2 100644 --- a/include/oox/core/filterbase.hxx +++ b/include/oox/core/filterbase.hxx @@ -51,9 +51,6 @@ namespace com::sun::star { namespace comphelper { class SequenceAsHashMap; } -namespace utl { - class MediaDescriptor; -} namespace oox { class GraphicHelper; @@ -137,7 +134,7 @@ public: ::comphelper::SequenceAsHashMap& getFilterData() const; /** Returns the media descriptor. */ - utl::MediaDescriptor& getMediaDescriptor() const; + comphelper::SequenceAsHashMap& getMediaDescriptor() const; /** Returns the URL of the imported or exported file. */ const OUString& getFileUrl() const; @@ -241,11 +238,11 @@ public: protected: virtual css::uno::Reference< css::io::XInputStream > - implGetInputStream( utl::MediaDescriptor& rMediaDesc ) const; + implGetInputStream( comphelper::SequenceAsHashMap& rMediaDesc ) const; virtual css::uno::Reference< css::io::XStream > - implGetOutputStream( utl::MediaDescriptor& rMediaDesc ) const; + implGetOutputStream( comphelper::SequenceAsHashMap& rMediaDesc ) const; - virtual bool implFinalizeExport( utl::MediaDescriptor& rMediaDescriptor ); + virtual bool implFinalizeExport( comphelper::SequenceAsHashMap& rMediaDescriptor ); css::uno::Reference< css::io::XStream > const & getMainDocumentStream( ) const; diff --git a/include/oox/core/filterdetect.hxx b/include/oox/core/filterdetect.hxx index 89b71c603f09..2d2b50260b95 100644 --- a/include/oox/core/filterdetect.hxx +++ b/include/oox/core/filterdetect.hxx @@ -36,7 +36,7 @@ namespace com::sun::star { namespace uno { class XComponentContext; } } -namespace utl { class MediaDescriptor; } +namespace comphelper { class SequenceAsHashMap; } namespace oox { class AttributeList; } @@ -126,7 +126,7 @@ public: its input stream is returned. */ css::uno::Reference< css::io::XInputStream > - extractUnencryptedPackage( utl::MediaDescriptor& rMediaDesc ) const; + extractUnencryptedPackage( comphelper::SequenceAsHashMap& rMediaDesc ) const; // com.sun.star.lang.XServiceInfo interface ------------------------------- diff --git a/include/oox/core/xmlfilterbase.hxx b/include/oox/core/xmlfilterbase.hxx index fe69eb7f3c10..a89a4ad9818d 100644 --- a/include/oox/core/xmlfilterbase.hxx +++ b/include/oox/core/xmlfilterbase.hxx @@ -259,12 +259,12 @@ public: protected: virtual css::uno::Reference< css::io::XInputStream > - implGetInputStream( utl::MediaDescriptor& rMediaDesc ) const override; + implGetInputStream( comphelper::SequenceAsHashMap& rMediaDesc ) const override; virtual css::uno::Reference< css::io::XStream > - implGetOutputStream( utl::MediaDescriptor& rMediaDesc ) const override; + implGetOutputStream( comphelper::SequenceAsHashMap& rMediaDesc ) const override; - virtual bool implFinalizeExport( utl::MediaDescriptor& rMediaDescriptor ) override; + virtual bool implFinalizeExport(comphelper::SequenceAsHashMap& rMediaDescriptor) override; private: virtual StorageRef implCreateStorage( diff --git a/include/unotools/mediadescriptor.hxx b/include/unotools/mediadescriptor.hxx index 07d678d588a3..e9b36a33a94a 100644 --- a/include/unotools/mediadescriptor.hxx +++ b/include/unotools/mediadescriptor.hxx @@ -25,314 +25,221 @@ #include #include -#include #include #include namespace com::sun::star::io { class XInputStream; } -namespace comphelper { class IDocPasswordVerifier; } +namespace com::sun::star::beans { + struct NamedValue; +} +namespace comphelper { class IDocPasswordVerifier; class SequenceAsHashMap; } -namespace utl { +namespace utl::MediaDescriptor { /** @short can be used to work with a css::document::MediaDescriptor struct. - @descr It wraps an unordered_map around the Sequence< css::beans::PropertyValue >, which - represent the MediaDescriptor item. - Further this helper defines often used functions (as e.g. open of the required streams, - consistent checks etcpp.) and it defines all usable property names. + @descr Defines often used functions (as e.g. open of the required streams, consistent checks + etcpp.) and all usable property names, for use with comphelper::SequenceAsHashMap, + which represent the MediaDescriptor item. - @attention This class isn't threadsafe and must be guarded from outside! + @attention The functions aren't threadsafe and must be guarded from outside! */ -class UNOTOOLS_DLLPUBLIC MediaDescriptor : public comphelper::SequenceAsHashMap -{ - public: +constexpr inline OUString PROP_ABORTED = u"Aborted"_ustr; +constexpr inline OUString PROP_ASTEMPLATE = u"AsTemplate"_ustr; +constexpr inline OUString PROP_COMPONENTDATA = u"ComponentData"_ustr; +constexpr inline OUString PROP_DOCUMENTSERVICE = u"DocumentService"_ustr; +constexpr inline OUString PROP_ENCRYPTIONDATA = u"EncryptionData"_ustr; +constexpr inline OUString PROP_FILENAME = u"FileName"_ustr; +constexpr inline OUString PROP_FILTERNAME = u"FilterName"_ustr; +constexpr inline OUString PROP_FILTERPROVIDER = u"FilterProvider"_ustr; +constexpr inline OUString PROP_FILTEROPTIONS = u"FilterOptions"_ustr; +constexpr inline OUString PROP_FRAME = u"Frame"_ustr; +constexpr inline OUString PROP_FRAMENAME = u"FrameName"_ustr; +constexpr inline OUString PROP_HIDDEN = u"Hidden"_ustr; +constexpr inline OUString PROP_INPUTSTREAM = u"InputStream"_ustr; +constexpr inline OUString PROP_INTERACTIONHANDLER = u"InteractionHandler"_ustr; +constexpr inline OUString PROP_AUTHENTICATIONHANDLER = u"AuthenticationHandler"_ustr; +constexpr inline OUString PROP_JUMPMARK = u"JumpMark"_ustr; +constexpr inline OUString PROP_MACROEXECUTIONMODE = u"MacroExecutionMode"_ustr; +constexpr inline OUString PROP_MEDIATYPE = u"MediaType"_ustr; +constexpr inline OUString PROP_MINIMIZED = u"Minimized"_ustr; +constexpr inline OUString PROP_NOAUTOSAVE = u"NoAutoSave"_ustr; +constexpr inline OUString PROP_OPENNEWVIEW = u"OpenNewView"_ustr; +constexpr inline OUString PROP_OUTPUTSTREAM = u"OutputStream"_ustr; +constexpr inline OUString PROP_PASSWORD = u"Password"_ustr; +constexpr inline OUString PROP_POSTDATA = u"PostData"_ustr; +constexpr inline OUString PROP_PREVIEW = u"Preview"_ustr; +constexpr inline OUString PROP_READONLY = u"ReadOnly"_ustr; +constexpr inline OUString PROP_REFERRER = u"Referer"_ustr; +constexpr inline OUString PROP_REPLACEABLE = u"Replaceable"_ustr; +constexpr inline OUString PROP_SALVAGEDFILE = u"SalvagedFile"_ustr; +constexpr inline OUString PROP_SILENT = u"Silent"_ustr; +constexpr inline OUString PROP_STATUSINDICATOR = u"StatusIndicator"_ustr; +constexpr inline OUString PROP_STREAM = u"Stream"_ustr; +constexpr inline OUString PROP_STREAMFOROUTPUT = u"StreamForOutput"_ustr; +constexpr inline OUString PROP_TEMPLATENAME = u"TemplateName"_ustr; +constexpr inline OUString PROP_TITLE = u"Title"_ustr; +constexpr inline OUString PROP_TYPENAME = u"TypeName"_ustr; +constexpr inline OUString PROP_UCBCONTENT = u"UCBContent"_ustr; +constexpr inline OUString PROP_UPDATEDOCMODE = u"UpdateDocMode"_ustr; +constexpr inline OUString PROP_URL = u"URL"_ustr; +constexpr inline OUString PROP_VERSION = u"Version"_ustr; +constexpr inline OUString PROP_DOCUMENTTITLE = u"DocumentTitle"_ustr; +constexpr inline OUString PROP_MODEL = u"Model"_ustr; +constexpr inline OUString PROP_VIEWONLY = u"ViewOnly"_ustr; +constexpr inline OUString PROP_DOCUMENTBASEURL = u"DocumentBaseURL"_ustr; +constexpr inline OUString PROP_SUGGESTEDSAVEASNAME = u"SuggestedSaveAsName"_ustr; +constexpr inline OUString PROP_EXPORTDIRECTORY = u"ExportDirectory"_ustr; +constexpr inline OUString PROP_AUTOSAVEEVENT = u"AutoSaveEvent"_ustr; - /** @short these methods can be used to get the different property names - as static const OUString values. +/** @short it checks if the descriptor already has a valid + InputStream item and creates a new one, if not. - @descr Because definition and declaration of static const class members - does not work as expected under windows (under unix it works as well) - these way must be used :-( - */ - static constexpr OUString PROP_ABORTED = u"Aborted"_ustr; - static constexpr OUString PROP_ASTEMPLATE = u"AsTemplate"_ustr; - static constexpr OUString PROP_COMPONENTDATA = u"ComponentData"_ustr; - static constexpr OUString PROP_DOCUMENTSERVICE = u"DocumentService"_ustr; - static constexpr OUString PROP_ENCRYPTIONDATA = u"EncryptionData"_ustr; - static constexpr OUString PROP_FILENAME = u"FileName"_ustr; - static constexpr OUString PROP_FILTERNAME = u"FilterName"_ustr; - static constexpr OUString PROP_FILTERPROVIDER = u"FilterProvider"_ustr; - static constexpr OUString PROP_FILTEROPTIONS = u"FilterOptions"_ustr; - static constexpr OUString PROP_FRAME = u"Frame"_ustr; - static constexpr OUString PROP_FRAMENAME = u"FrameName"_ustr; - static constexpr OUString PROP_HIDDEN = u"Hidden"_ustr; - static constexpr OUString PROP_INPUTSTREAM = u"InputStream"_ustr; - static constexpr OUString PROP_INTERACTIONHANDLER = u"InteractionHandler"_ustr; - static constexpr OUString PROP_AUTHENTICATIONHANDLER = u"AuthenticationHandler"_ustr; - static constexpr OUString PROP_JUMPMARK = u"JumpMark"_ustr; - static constexpr OUString PROP_MACROEXECUTIONMODE = u"MacroExecutionMode"_ustr; - static constexpr OUString PROP_MEDIATYPE = u"MediaType"_ustr; - static constexpr OUString PROP_MINIMIZED = u"Minimized"_ustr; - static constexpr OUString PROP_NOAUTOSAVE = u"NoAutoSave"_ustr; - static constexpr OUString PROP_OPENNEWVIEW = u"OpenNewView"_ustr; - static constexpr OUString PROP_OUTPUTSTREAM = u"OutputStream"_ustr; - static constexpr OUString PROP_PASSWORD = u"Password"_ustr; - static constexpr OUString PROP_POSTDATA = u"PostData"_ustr; - static constexpr OUString PROP_PREVIEW = u"Preview"_ustr; - static constexpr OUString PROP_READONLY = u"ReadOnly"_ustr; - static constexpr OUString PROP_REFERRER = u"Referer"_ustr; - static constexpr OUString PROP_REPLACEABLE = u"Replaceable"_ustr; - static constexpr OUString PROP_SALVAGEDFILE = u"SalvagedFile"_ustr; - static constexpr OUString PROP_SILENT = u"Silent"_ustr; - static constexpr OUString PROP_STATUSINDICATOR = u"StatusIndicator"_ustr; - static constexpr OUString PROP_STREAM = u"Stream"_ustr; - static constexpr OUString PROP_STREAMFOROUTPUT = u"StreamForOutput"_ustr; - static constexpr OUString PROP_TEMPLATENAME = u"TemplateName"_ustr; - static constexpr OUString PROP_TITLE = u"Title"_ustr; - static constexpr OUString PROP_TYPENAME = u"TypeName"_ustr; - static constexpr OUString PROP_UCBCONTENT = u"UCBContent"_ustr; - static constexpr OUString PROP_UPDATEDOCMODE = u"UpdateDocMode"_ustr; - static constexpr OUString PROP_URL = u"URL"_ustr; - static constexpr OUString PROP_VERSION = u"Version"_ustr; - static constexpr OUString PROP_DOCUMENTTITLE = u"DocumentTitle"_ustr; - static constexpr OUString PROP_MODEL = u"Model"_ustr; - static constexpr OUString PROP_VIEWONLY = u"ViewOnly"_ustr; - static constexpr OUString PROP_DOCUMENTBASEURL = u"DocumentBaseURL"_ustr; - static constexpr OUString PROP_SUGGESTEDSAVEASNAME = u"SuggestedSaveAsName"_ustr; - static constexpr OUString PROP_EXPORTDIRECTORY = u"ExportDirectory"_ustr; - static constexpr OUString PROP_AUTOSAVEEVENT = u"AutoSaveEvent"_ustr; + @descr This function uses the current items of this MediaDescriptor, + to open the stream (as e.g. URL, ReadOnly, PostData etcpp.). + It creates a seekable stream and put it into the descriptor. - // interface - public: + A might existing InteractionHandler will be used automatically, + to solve problems! - /** @short these ctors do nothing - excepting that they forward - the given parameters to the base class ctors. + In case of local file the system file locking is used. - @descr The ctors must be overwritten to resolve conflicts with - the default ctors of the compiler :-(. - */ - MediaDescriptor(); - MediaDescriptor(const css::uno::Sequence< css::beans::PropertyValue >& lSource); + @return TRUE, if the stream was already part of the descriptor or could + be created as new item. FALSE otherwise. + */ +UNOTOOLS_DLLPUBLIC bool addInputStream(comphelper::SequenceAsHashMap& rMediaDescriptor); - /** @short it checks if the descriptor already has a valid - InputStream item and creates a new one, if not. +/** @short it checks if the descriptor already has a valid + InputStream item and creates a new one, if not. - @descr This method uses the current items of this MediaDescriptor, - to open the stream (as e.g. URL, ReadOnly, PostData etcpp.). - It creates a seekable stream and put it into the descriptor. + @descr This function uses the current items of this MediaDescriptor, + to open the stream (as e.g. URL, ReadOnly, PostData etcpp.). + It creates a seekable stream and put it into the descriptor. - A might existing InteractionHandler will be used automatically, - to solve problems! + A might existing InteractionHandler will be used automatically, + to solve problems! - In case of local file the system file locking is used. + In case of local file the system file locking is used based on + configuration settings. - @return TRUE, if the stream was already part of the descriptor or could - be created as new item. FALSE otherwise. - */ - bool addInputStream(); + @return TRUE, if the stream was already part of the descriptor or could + be created as new item. FALSE otherwise. + */ +UNOTOOLS_DLLPUBLIC bool addInputStreamOwnLock(comphelper::SequenceAsHashMap& rMediaDescriptor); - /** @short it checks if the descriptor already has a valid - InputStream item and creates a new one, if not. +/** @short it checks if the descriptor describes a readonly stream. - @descr This method uses the current items of this MediaDescriptor, - to open the stream (as e.g. URL, ReadOnly, PostData etcpp.). - It creates a seekable stream and put it into the descriptor. + @descr The descriptor itself isn't changed doing so. + It's only checked if the stream seems to be based + of a real readonly file. - A might existing InteractionHandler will be used automatically, - to solve problems! + @Attention + We don't check the property "ReadOnly" here. Because + this property can be set from outside and overwrites + the readonly state of the stream. + If e.g. the stream could be opened read/write ... + but "ReadOnly" property is set to TRUE, this means: + show a readonly UI on top of this read/write stream. - In case of local file the system file locking is used based on - configuration settings. + @return TRUE, if the stream must be interpreted as readonly ... + FALSE otherwise. + */ +UNOTOOLS_DLLPUBLIC bool isStreamReadOnly(const comphelper::SequenceAsHashMap& rMediaDescriptor); - @return TRUE, if the stream was already part of the descriptor or could - be created as new item. FALSE otherwise. - */ - bool addInputStreamOwnLock(); +/** Returns a value from the sequence contained in the property + 'ComponentData' of this media descriptor. - /** @short it checks if the descriptor describes a readonly stream. + @descr The property 'ComponentData' should be empty, or should + contain a value of type sequence + or sequence. - @descr The descriptor itself isn't changed doing so. - It's only checked if the stream seems to be based - of a real readonly file. + @return The value with the specified name, if existing in the + sequence of the 'ComponentData' property, otherwise an empty + Any. + */ +UNOTOOLS_DLLPUBLIC css::uno::Any +getComponentDataEntry(const comphelper::SequenceAsHashMap& rMediaDescriptor, const OUString& rName); - @Attention - We don't check the property "ReadOnly" here. Because - this property can be set from outside and overwrites - the readonly state of the stream. - If e.g. the stream could be opened read/write ... - but "ReadOnly" property is set to TRUE, this means: - show a readonly UI on top of this read/write stream. +/** Inserts a value into the sequence contained in the property + 'ComponentData' of the media descriptor. - @return TRUE, if the stream must be interpreted as readonly ... - FALSE otherwise. - */ - bool isStreamReadOnly() const; + @descr The property 'ComponentData' should be empty, or should + contain a value of type sequence + or sequence. The passed value + will be inserted into the sequence, or, if already existing, + will be overwritten. - /** Returns a value from the sequence contained in the property - 'ComponentData' of this media descriptor. + @param rName The name of the value to be inserted into the + sequence of the 'ComponentData' property. - @descr The property 'ComponentData' should be empty, or should - contain a value of type sequence - or sequence. + @param rValue The value to be inserted into the sequence of the + 'ComponentData' property. + */ +UNOTOOLS_DLLPUBLIC void setComponentDataEntry(comphelper::SequenceAsHashMap& rMediaDescriptor, + const OUString& rName, const css::uno::Any& rValue); - @return The value with the specified name, if existing in the - sequence of the 'ComponentData' property, otherwise an empty - Any. - */ - css::uno::Any getComponentDataEntry( - const OUString& rName ) const; +/** Removes a value from the sequence contained in the property + 'ComponentData' of the media descriptor. - /** Inserts a value into the sequence contained in the property - 'ComponentData' of the media descriptor. + @descr The property 'ComponentData' should be empty, or should + contain a value of type sequence + or sequence. The value with + the passed name will be removed from the sequence, if existing. - @descr The property 'ComponentData' should be empty, or should - contain a value of type sequence - or sequence. The passed value - will be inserted into the sequence, or, if already existing, - will be overwritten. + @param rName The name of the value to be removed from the sequence + of the 'ComponentData' property. + */ +UNOTOOLS_DLLPUBLIC void clearComponentDataEntry(comphelper::SequenceAsHashMap& rMediaDescriptor, + const OUString& rName); - @param rName The name of the value to be inserted into the - sequence of the 'ComponentData' property. +/** This helper function tries to find a password for the document + described by this media descriptor. - @param rValue The value to be inserted into the sequence of the - 'ComponentData' property. - */ - void setComponentDataEntry( - const OUString& rName, - const css::uno::Any& rValue ); + First, the list of default passwords will be tried if provided. This + is needed by import filters for external file formats that have to + check a predefined password in some cases without asking the user + for a password. Every password is checked using the passed password + verifier. - /** Removes a value from the sequence contained in the property - 'ComponentData' of the media descriptor. + If not successful, this media descriptor is asked for a password, + that has been set e.g. by an API call to load a document. If + existing, the password is checked using the passed password + verifier. - @descr The property 'ComponentData' should be empty, or should - contain a value of type sequence - or sequence. The value with - the passed name will be removed from the sequence, if existing. + If still not successful, the interaction handler contained in this + media descriptor is used to request a password from the user. This + will be repeated until the passed password verifier validates the + entered password, or if the user chooses to cancel password input. - @param rName The name of the value to be removed from the sequence - of the 'ComponentData' property. - */ - void clearComponentDataEntry( - const OUString& rName ); + If a valid password (that is not contained in the passed list of + default passwords) was found, it will be inserted into the + "Password" property of this descriptor. - /** This helper function tries to find a password for the document - described by this media descriptor. + @param rVerifier + The password verifier used to check every processed password. - First, the list of default passwords will be tried if provided. This - is needed by import filters for external file formats that have to - check a predefined password in some cases without asking the user - for a password. Every password is checked using the passed password - verifier. + @param eRequestType + The password request type that will be passed to the + DocPasswordRequest object created internally. See + docpasswordrequest.hxx for more details. - If not successful, this media descriptor is asked for a password, - that has been set e.g. by an API call to load a document. If - existing, the password is checked using the passed password - verifier. + @param pDefaultPasswords + If not null, contains default passwords that will be tried before a + password will be requested from the media descriptor or the user. - If still not successful, the interaction handler contained in this - media descriptor is used to request a password from the user. This - will be repeated until the passed password verifier validates the - entered password, or if the user chooses to cancel password input. - - If a valid password (that is not contained in the passed list of - default passwords) was found, it will be inserted into the - "Password" property of this descriptor. - - @param rVerifier - The password verifier used to check every processed password. - - @param eRequestType - The password request type that will be passed to the - DocPasswordRequest object created internally. See - docpasswordrequest.hxx for more details. - - @param pDefaultPasswords - If not null, contains default passwords that will be tried before a - password will be requested from the media descriptor or the user. - - @return - If not empty, contains the password that has been validated by the - passed password verifier. If empty, no valid password has been - found, or the user has chosen to cancel password input. - */ - css::uno::Sequence< css::beans::NamedValue > requestAndVerifyDocPassword( - comphelper::IDocPasswordVerifier& rVerifier, - comphelper::DocPasswordRequestType eRequestType, - const ::std::vector< OUString >* pDefaultPasswords ); - - // helper - private: - - /** @short tries to open a stream by using the given PostData stream. - - @descr The stream is used directly ... - - The MediaDescriptor itself is changed inside this method. - Means: the stream is added internal and not returned by a value. - - @param _rxPostData - the PostData stream. - - @return TRUE if the stream could be added successfully. - Note: If FALSE is returned, the error was already handled inside! - - @throw [css::uno::RuntimeException] - if the MediaDescriptor seems to be invalid! - - @throw [css::lang::IllegalArgumentException] - if the given PostData stream is . - */ - SAL_DLLPRIVATE bool impl_openStreamWithPostData( - const css::uno::Reference< css::io::XInputStream >& _rxPostData - ); - - /** @short tries to open a stream by using the given URL. - - @descr First it tries to open the content in r/w mode (if its - allowed to do so). Only in case it's not allowed or it failed - the stream will be tried to open in readonly mode. - - The MediaDescriptor itself is changed inside this method. - Means: the stream is added internal and not returned by a value. - - @param sURL - the URL for open. - - @param bLockFile - specifies whether the file should be locked - - @return TRUE if the stream could be added successfully. - Note: If FALSE is returned, the error was already handled inside! - - @throw [css::uno::RuntimeException] - if the MediaDescriptor seems to be invalid! - */ - SAL_DLLPRIVATE bool impl_openStreamWithURL( - const OUString& sURL, - bool bLockFile - ); - - /** @short it checks if the descriptor already has a valid - InputStream item and creates a new one, if not. - - @descr This method uses the current items of this MediaDescriptor, - to open the stream (as e.g. URL, ReadOnly, PostData etcpp.). - It creates a seekable stream and put it into the descriptor. - - A might existing InteractionHandler will be used automatically, - to solve problems! - - @param bLockFile - specifies whether the file should be locked - - @return TRUE, if the stream was already part of the descriptor or could - be created as new item. FALSE otherwise. - */ - SAL_DLLPRIVATE bool impl_addInputStream( bool bLockFile ); -}; + @return + If not empty, contains the password that has been validated by the + passed password verifier. If empty, no valid password has been + found, or the user has chosen to cancel password input. + */ +UNOTOOLS_DLLPUBLIC css::uno::Sequence +requestAndVerifyDocPassword(comphelper::SequenceAsHashMap& rMediaDescriptor, + comphelper::IDocPasswordVerifier& rVerifier, + comphelper::DocPasswordRequestType eRequestType, + const ::std::vector* pDefaultPasswords); } diff --git a/oox/source/core/filterbase.cxx b/oox/source/core/filterbase.cxx index 849665bbd4cf..2a40fadd3dc1 100644 --- a/oox/source/core/filterbase.cxx +++ b/oox/source/core/filterbase.cxx @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -57,7 +58,6 @@ using namespace ::com::sun::star::task; using namespace ::com::sun::star::uno; using ::com::sun::star::container::XNameAccess; -using utl::MediaDescriptor; using ::comphelper::SequenceAsHashMap; using ::oox::ole::OleObjectHelper; using ::oox::ole::VbaProject; @@ -132,7 +132,7 @@ struct FilterBaseImpl FilterDirection meDirection; SequenceAsHashMap maArguments; SequenceAsHashMap maFilterData; - MediaDescriptor maMediaDesc; + SequenceAsHashMap maMediaDesc; OUString maFileUrl; StorageRef mxStorage; OoxmlVersion meVersion; @@ -235,7 +235,7 @@ const Reference< XStatusIndicator >& FilterBase::getStatusIndicator() const return mxImpl->mxStatusIndicator; } -MediaDescriptor& FilterBase::getMediaDescriptor() const +SequenceAsHashMap& FilterBase::getMediaDescriptor() const { return mxImpl->maMediaDesc; } @@ -503,17 +503,17 @@ void SAL_CALL FilterBase::cancel() // protected -Reference< XInputStream > FilterBase::implGetInputStream( MediaDescriptor& rMediaDesc ) const +Reference< XInputStream > FilterBase::implGetInputStream( SequenceAsHashMap& rMediaDesc ) const { - return rMediaDesc.getUnpackedValueOrDefault( MediaDescriptor::PROP_INPUTSTREAM, Reference< XInputStream >() ); + return rMediaDesc.getUnpackedValueOrDefault( utl::MediaDescriptor::PROP_INPUTSTREAM, Reference< XInputStream >() ); } -Reference< XStream > FilterBase::implGetOutputStream( MediaDescriptor& rMediaDesc ) const +Reference< XStream > FilterBase::implGetOutputStream( SequenceAsHashMap& rMediaDesc ) const { - return rMediaDesc.getUnpackedValueOrDefault( MediaDescriptor::PROP_STREAMFOROUTPUT, Reference< XStream >() ); + return rMediaDesc.getUnpackedValueOrDefault( utl::MediaDescriptor::PROP_STREAMFOROUTPUT, Reference< XStream >() ); } -bool FilterBase::implFinalizeExport( MediaDescriptor& /*rMediaDescriptor*/ ) +bool FilterBase::implFinalizeExport( SequenceAsHashMap& /*rMediaDescriptor*/ ) { return true; } @@ -535,7 +535,7 @@ void FilterBase::setMediaDescriptor( const Sequence< PropertyValue >& rMediaDesc OSL_FAIL( "FilterBase::setMediaDescriptor - invalid filter direction" ); break; case FILTERDIRECTION_IMPORT: - mxImpl->maMediaDesc.addInputStream(); + utl::MediaDescriptor::addInputStream(mxImpl->maMediaDesc); mxImpl->mxInStream = implGetInputStream( mxImpl->maMediaDesc ); OSL_ENSURE( mxImpl->mxInStream.is(), "FilterBase::setMediaDescriptor - missing input stream" ); break; @@ -545,9 +545,9 @@ void FilterBase::setMediaDescriptor( const Sequence< PropertyValue >& rMediaDesc break; } - mxImpl->maFileUrl = mxImpl->maMediaDesc.getUnpackedValueOrDefault( MediaDescriptor::PROP_URL, OUString() ); - mxImpl->mxTargetFrame = mxImpl->maMediaDesc.getUnpackedValueOrDefault( MediaDescriptor::PROP_FRAME, Reference< XFrame >() ); - mxImpl->mxStatusIndicator = mxImpl->maMediaDesc.getUnpackedValueOrDefault( MediaDescriptor::PROP_STATUSINDICATOR, Reference< XStatusIndicator >() ); + mxImpl->maFileUrl = mxImpl->maMediaDesc.getUnpackedValueOrDefault( utl::MediaDescriptor::PROP_URL, OUString() ); + mxImpl->mxTargetFrame = mxImpl->maMediaDesc.getUnpackedValueOrDefault( utl::MediaDescriptor::PROP_FRAME, Reference< XFrame >() ); + mxImpl->mxStatusIndicator = mxImpl->maMediaDesc.getUnpackedValueOrDefault( utl::MediaDescriptor::PROP_STATUSINDICATOR, Reference< XStatusIndicator >() ); mxImpl->mxParentShape = mxImpl->maMediaDesc.getUnpackedValueOrDefault( u"ParentShape"_ustr, mxImpl->mxParentShape ); mxImpl->maFilterData = mxImpl->maMediaDesc.getUnpackedValueOrDefault( u"FilterData"_ustr, Sequence< PropertyValue >() ); diff --git a/oox/source/core/filterdetect.cxx b/oox/source/core/filterdetect.cxx index b48df147673b..8ee4fc1a179b 100644 --- a/oox/source/core/filterdetect.cxx +++ b/oox/source/core/filterdetect.cxx @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -50,7 +51,6 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::xml::sax; using namespace ::com::sun::star::uri; -using utl::MediaDescriptor; using comphelper::IDocPasswordVerifier; using comphelper::DocPasswordVerifierResult; @@ -335,16 +335,16 @@ comphelper::DocPasswordVerifierResult PasswordVerifier::verifyEncryptionData( co } // namespace -Reference< XInputStream > FilterDetect::extractUnencryptedPackage( MediaDescriptor& rMediaDescriptor ) const +Reference< XInputStream > FilterDetect::extractUnencryptedPackage( comphelper::SequenceAsHashMap& rMediaDescriptor ) const { const bool bRepairPackage(rMediaDescriptor.getUnpackedValueOrDefault(u"RepairPackage"_ustr, false)); // try the plain input stream - Reference xInputStream( rMediaDescriptor[ MediaDescriptor::PROP_INPUTSTREAM ], UNO_QUERY ); + Reference xInputStream( rMediaDescriptor[ utl::MediaDescriptor::PROP_INPUTSTREAM ], UNO_QUERY ); if (!xInputStream.is() || lclIsZipPackage(mxContext, xInputStream, bRepairPackage)) return xInputStream; // check if a temporary file is passed in the 'ComponentData' property - Reference xDecrypted( rMediaDescriptor.getComponentDataEntry( u"DecryptedPackage"_ustr ), UNO_QUERY ); + Reference xDecrypted( utl::MediaDescriptor::getComponentDataEntry(rMediaDescriptor, u"DecryptedPackage"_ustr ), UNO_QUERY ); if( xDecrypted.is() ) { Reference xDecryptedInputStream = xDecrypted->getInputStream(); @@ -374,14 +374,15 @@ Reference< XInputStream > FilterDetect::extractUnencryptedPackage( MediaDescript (according to the verifier), or with an empty string if user has cancelled the password input dialog. */ PasswordVerifier aVerifier( aDecryptor ); - Sequence aEncryptionData = rMediaDescriptor.requestAndVerifyDocPassword( + Sequence aEncryptionData = utl::MediaDescriptor::requestAndVerifyDocPassword( + rMediaDescriptor, aVerifier, comphelper::DocPasswordRequestType::MS, &aDefaultPasswords ); if( !aEncryptionData.hasElements() ) { - rMediaDescriptor[ MediaDescriptor::PROP_ABORTED ] <<= true; + rMediaDescriptor[ utl::MediaDescriptor::PROP_ABORTED ] <<= true; } else { @@ -391,12 +392,12 @@ Reference< XInputStream > FilterDetect::extractUnencryptedPackage( MediaDescript // if decryption was unsuccessful (corrupted file or any other reason) if (!aDecryptor.decrypt(xTempStream)) { - rMediaDescriptor[ MediaDescriptor::PROP_ABORTED ] <<= true; + rMediaDescriptor[ utl::MediaDescriptor::PROP_ABORTED ] <<= true; } else { // store temp file in media descriptor to keep it alive - rMediaDescriptor.setComponentDataEntry( u"DecryptedPackage"_ustr, Any( Reference(xTempStream) ) ); + utl::MediaDescriptor::setComponentDataEntry(rMediaDescriptor, u"DecryptedPackage"_ustr, Any( Reference(xTempStream) ) ); Reference xDecryptedInputStream = xTempStream->getInputStream(); if (lclIsZipPackage(mxContext, xDecryptedInputStream, bRepairPackage)) @@ -434,11 +435,11 @@ Sequence< OUString > SAL_CALL FilterDetect::getSupportedServiceNames() OUString SAL_CALL FilterDetect::detect( Sequence< PropertyValue >& rMediaDescSeq ) { OUString aFilterName; - MediaDescriptor aMediaDescriptor( rMediaDescSeq ); + comphelper::SequenceAsHashMap aMediaDescriptor(rMediaDescSeq); try { - aMediaDescriptor.addInputStream(); + utl::MediaDescriptor::addInputStream(aMediaDescriptor); /* Get the unencrypted input stream. This may include creation of a temporary file that contains the decrypted package. This temporary @@ -481,7 +482,7 @@ OUString SAL_CALL FilterDetect::detect( Sequence< PropertyValue >& rMediaDescSeq } catch( const Exception& ) { - if ( aMediaDescriptor.getUnpackedValueOrDefault( MediaDescriptor::PROP_ABORTED, false ) ) + if ( aMediaDescriptor.getUnpackedValueOrDefault( utl::MediaDescriptor::PROP_ABORTED, false ) ) /* The user chose to abort detection, e.g. by hitting 'Cancel' in the password input dialog, so we have to return non-empty type name to abort the detection loop. The loading code is supposed to check whether the "Aborted" flag is present in the descriptor, and to not attempt @@ -492,7 +493,7 @@ OUString SAL_CALL FilterDetect::detect( Sequence< PropertyValue >& rMediaDescSeq already know that the file is OLE encrypted package, so trying with other type detectors doesn't make much sense anyway. */ - aFilterName = aMediaDescriptor.getUnpackedValueOrDefault( MediaDescriptor::PROP_TYPENAME, OUString() ); + aFilterName = aMediaDescriptor.getUnpackedValueOrDefault( utl::MediaDescriptor::PROP_TYPENAME, OUString() ); } // write back changed media descriptor members diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx index c6328ab5e358..b25930e29e0e 100644 --- a/oox/source/core/xmlfilterbase.cxx +++ b/oox/source/core/xmlfilterbase.cxx @@ -64,6 +64,7 @@ #include #include #include +#include #include #include @@ -89,7 +90,6 @@ using namespace ::com::sun::star::lang; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::xml::sax; -using utl::MediaDescriptor; using ::sax_fastparser::FSHelperPtr; using ::sax_fastparser::FastSerializerHelper; @@ -292,7 +292,7 @@ void XmlFilterBase::putPropertiesToDocumentGrabBag(const css::uno::Reference xInputStream; Reference< XComponentContext > xContext = getComponentContext(); rtl::Reference< ::oox::core::FilterDetect > xDetector( new ::oox::core::FilterDetect( xContext ) ); @@ -1034,7 +1034,7 @@ void XmlFilterBase::exportDocumentProperties( const Reference< XDocumentProperti // protected ------------------------------------------------------------------ -Reference< XInputStream > XmlFilterBase::implGetInputStream( MediaDescriptor& rMediaDesc ) const +Reference< XInputStream > XmlFilterBase::implGetInputStream( comphelper::SequenceAsHashMap& rMediaDesc ) const { /* Get the input stream directly from the media descriptor, or decrypt the package again. The latter is needed e.g. when the document is reloaded. @@ -1043,10 +1043,10 @@ Reference< XInputStream > XmlFilterBase::implGetInputStream( MediaDescriptor& rM return xDetector->extractUnencryptedPackage( rMediaDesc ); } -Reference XmlFilterBase::implGetOutputStream( MediaDescriptor& rMediaDescriptor ) const +Reference XmlFilterBase::implGetOutputStream( comphelper::SequenceAsHashMap& rMediaDescriptor ) const { const Sequence< NamedValue > aMediaEncData = rMediaDescriptor.getUnpackedValueOrDefault( - MediaDescriptor::PROP_ENCRYPTIONDATA, + utl::MediaDescriptor::PROP_ENCRYPTIONDATA, Sequence< NamedValue >() ); if (aMediaEncData.getLength() == 0) @@ -1059,12 +1059,12 @@ Reference XmlFilterBase::implGetOutputStream( MediaDescriptor& rMediaDe } } -bool XmlFilterBase::implFinalizeExport( MediaDescriptor& rMediaDescriptor ) +bool XmlFilterBase::implFinalizeExport(comphelper::SequenceAsHashMap& rMediaDescriptor) { bool bRet = true; const Sequence< NamedValue > aMediaEncData = rMediaDescriptor.getUnpackedValueOrDefault( - MediaDescriptor::PROP_ENCRYPTIONDATA, + utl::MediaDescriptor::PROP_ENCRYPTIONDATA, Sequence< NamedValue >() ); if (aMediaEncData.getLength()) diff --git a/oox/source/drawingml/chart/objectformatter.cxx b/oox/source/drawingml/chart/objectformatter.cxx index 698da92fe8bf..d045bc03c507 100644 --- a/oox/source/drawingml/chart/objectformatter.cxx +++ b/oox/source/drawingml/chart/objectformatter.cxx @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index ff2d2edabea7..4f2f9dc8d6a9 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -62,6 +62,7 @@ #include #include #include +#include #include #include #include diff --git a/reportdesign/inc/ReportDefinition.hxx b/reportdesign/inc/ReportDefinition.hxx index a8cd809c3282..1d5fc5ebc86d 100644 --- a/reportdesign/inc/ReportDefinition.hxx +++ b/reportdesign/inc/ReportDefinition.hxx @@ -58,9 +58,9 @@ namespace rptxml { class ORptExport; } -namespace utl +namespace comphelper { - class MediaDescriptor; + class SequenceAsHashMap; } namespace reportdesign { @@ -143,7 +143,7 @@ namespace reportdesign void notifyEvent(const OUString& _sEventName); void init(); - void fillArgs(utl::MediaDescriptor& _aDescriptor); + void fillArgs(comphelper::SequenceAsHashMap& _aDescriptor); css::uno::Reference< css::frame::XTitle > impl_getTitleHelper_throw(); css::uno::Reference< css::frame::XUntitledNumbers > impl_getUntitledHelper_throw(); diff --git a/reportdesign/source/core/api/ReportDefinition.cxx b/reportdesign/source/core/api/ReportDefinition.cxx index 0d636d1af7fe..9663d1c83f97 100644 --- a/reportdesign/source/core/api/ReportDefinition.cxx +++ b/reportdesign/source/core/api/ReportDefinition.cxx @@ -94,6 +94,7 @@ #include #include #include +#include #include #include #include @@ -191,7 +192,7 @@ static void lcl_setModelReadOnly(const uno::Reference< embed::XStorage >& _xStor _rModel->SetReadOnly((nOpenMode & embed::ElementModes::WRITE) != embed::ElementModes::WRITE); } -static void lcl_stripLoadArguments( utl::MediaDescriptor& _rDescriptor, uno::Sequence< beans::PropertyValue >& _rArgs ) +static void lcl_stripLoadArguments( comphelper::SequenceAsHashMap& _rDescriptor, uno::Sequence< beans::PropertyValue >& _rArgs ) { _rDescriptor.erase( u"StatusIndicator"_ustr ); _rDescriptor.erase( u"InteractionHandler"_ustr ); @@ -199,7 +200,7 @@ static void lcl_stripLoadArguments( utl::MediaDescriptor& _rDescriptor, uno::Seq _rDescriptor >> _rArgs; } -static void lcl_extractAndStartStatusIndicator( const utl::MediaDescriptor& _rDescriptor, uno::Reference< task::XStatusIndicator >& _rxStatusIndicator, +static void lcl_extractAndStartStatusIndicator( const comphelper::SequenceAsHashMap& _rDescriptor, uno::Reference< task::XStatusIndicator >& _rxStatusIndicator, uno::Sequence< uno::Any >& _rCallArgs ) { try @@ -1110,7 +1111,7 @@ sal_Bool SAL_CALL OReportDefinition::attachResource( const OUString& /*_rURL*/, ::osl::MutexGuard aGuard(m_aMutex); ::connectivity::checkDisposed( ReportDefinitionBase::rBHelper.bDisposed ); - utl::MediaDescriptor aDescriptor( _aArguments ); + comphelper::SequenceAsHashMap aDescriptor(_aArguments); m_pImpl->m_pUndoManager->GetSfxUndoManager().EnableUndo( false ); try @@ -1127,7 +1128,7 @@ sal_Bool SAL_CALL OReportDefinition::attachResource( const OUString& /*_rURL*/, return true; } -void OReportDefinition::fillArgs(utl::MediaDescriptor& _aDescriptor) +void OReportDefinition::fillArgs(comphelper::SequenceAsHashMap& _aDescriptor) { uno::Sequence aComponentData; aComponentData = _aDescriptor.getUnpackedValueOrDefault(u"ComponentData"_ustr,aComponentData); @@ -1230,7 +1231,7 @@ void OReportDefinition::impl_loadFromStorage_nolck_throw( const uno::Reference< { m_pImpl->m_xStorage = _xStorageToLoadFrom; - utl::MediaDescriptor aDescriptor( _aMediaDescriptor ); + comphelper::SequenceAsHashMap aDescriptor(_aMediaDescriptor); fillArgs(aDescriptor); aDescriptor.createItemIfMissing(u"Storage"_ustr,uno::Any(_xStorageToLoadFrom)); @@ -1259,7 +1260,7 @@ void OReportDefinition::impl_loadFromStorage_nolck_throw( const uno::Reference< uno::Reference xComponent(getXWeak(),uno::UNO_QUERY); xImporter->setTargetDocument(xComponent); - utl::MediaDescriptor aTemp; + comphelper::SequenceAsHashMap aTemp; aTemp << aDelegatorArguments; xFilter->filter(aTemp.getAsConstPropertyValueList()); @@ -1289,7 +1290,7 @@ void SAL_CALL OReportDefinition::storeToStorage( const uno::Reference< embed::XS // create XStatusIndicator uno::Reference xStatusIndicator; uno::Sequence< uno::Any > aDelegatorArguments; - utl::MediaDescriptor aDescriptor( _aMediaDescriptor ); + comphelper::SequenceAsHashMap aDescriptor(_aMediaDescriptor); lcl_extractAndStartStatusIndicator( aDescriptor, xStatusIndicator, aDelegatorArguments ); bool AutoSaveEvent = false; aDescriptor[utl::MediaDescriptor::PROP_AUTOSAVEEVENT] >>= AutoSaveEvent; diff --git a/reportdesign/source/filter/xml/xmlfilter.cxx b/reportdesign/source/filter/xml/xmlfilter.cxx index 3249b15641a3..90839b48de8e 100644 --- a/reportdesign/source/filter/xml/xmlfilter.cxx +++ b/reportdesign/source/filter/xml/xmlfilter.cxx @@ -45,6 +45,7 @@ #include #include +#include #include #include #include @@ -421,7 +422,7 @@ bool ORptFilter::implImport( const Sequence< PropertyValue >& rDescriptor ) { u"BaseURI"_ustr, 0, cppu::UnoType::get(), beans::PropertyAttribute::MAYBEVOID, 0 }, { u"StreamRelPath"_ustr, 0, cppu::UnoType::get(), beans::PropertyAttribute::MAYBEVOID, 0 }, }; - utl::MediaDescriptor aDescriptor(rDescriptor); + comphelper::SequenceAsHashMap aDescriptor(rDescriptor); uno::Reference xProp = comphelper::GenericPropertySet_CreateInstance(new comphelper::PropertySetInfo(pMap)); const OUString sVal( aDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_DOCUMENTBASEURL, OUString()) ); assert(!sVal.isEmpty()); // needed for relative URLs diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx index 309f9615f042..ac17a3d81c40 100644 --- a/reportdesign/source/ui/report/ReportController.cxx +++ b/reportdesign/source/ui/report/ReportController.cxx @@ -1683,7 +1683,7 @@ void OReportController::impl_initialize( const ::comphelper::NamedValueCollectio m_xFormatter.set(util::NumberFormatter::create(m_xContext), UNO_QUERY_THROW); m_xFormatter->attachNumberFormatsSupplier(Reference< XNumberFormatsSupplier>(m_xReportDefinition,uno::UNO_QUERY)); - utl::MediaDescriptor aDescriptor( m_xReportDefinition->getArgs() ); + comphelper::SequenceAsHashMap aDescriptor(m_xReportDefinition->getArgs()); OUString sHierarchicalDocumentName = aDescriptor.getUnpackedValueOrDefault(u"HierarchicalDocumentName"_ustr,OUString()); if ( sHierarchicalDocumentName.isEmpty() && getConnection().is() ) diff --git a/sc/source/filter/oox/viewsettings.cxx b/sc/source/filter/oox/viewsettings.cxx index 71147a72238a..33a1beb35f38 100644 --- a/sc/source/filter/oox/viewsettings.cxx +++ b/sc/source/filter/oox/viewsettings.cxx @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include diff --git a/sc/source/filter/oox/workbooksettings.cxx b/sc/source/filter/oox/workbooksettings.cxx index 2308c644e6fa..0914934a344a 100644 --- a/sc/source/filter/oox/workbooksettings.cxx +++ b/sc/source/filter/oox/workbooksettings.cxx @@ -26,6 +26,7 @@ #include #include +#include #include #include #include diff --git a/sc/source/filter/orcus/filterdetect.cxx b/sc/source/filter/orcus/filterdetect.cxx index ba94beda7782..6c4d371de9d5 100644 --- a/sc/source/filter/orcus/filterdetect.cxx +++ b/sc/source/filter/orcus/filterdetect.cxx @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -65,7 +66,7 @@ css::uno::Sequence OrcusFormatDetect::getSupportedServiceNames() OUString OrcusFormatDetect::detect(css::uno::Sequence& rMediaDescSeq) { - utl::MediaDescriptor aMediaDescriptor(rMediaDescSeq); + comphelper::SequenceAsHashMap aMediaDescriptor(rMediaDescSeq); bool bAborted = aMediaDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_ABORTED, false); if (bAborted) diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index 923a97253d0d..4b2ce461c2d2 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -1925,7 +1926,7 @@ bool ScDocShell::SaveAs( SfxMedium& rMedium ) if (pViewShell && bNeedsRehash) { bool bAutoSaveEvent = false; - utl::MediaDescriptor lArgs(rMedium.GetArgs()); + comphelper::SequenceAsHashMap lArgs(rMedium.GetArgs()); lArgs[utl::MediaDescriptor::PROP_AUTOSAVEEVENT] >>= bAutoSaveEvent; if (bAutoSaveEvent) { diff --git a/sc/source/ui/unoobj/exceldetect.cxx b/sc/source/ui/unoobj/exceldetect.cxx index cb0b3293e551..3b75a60e45f1 100644 --- a/sc/source/ui/unoobj/exceldetect.cxx +++ b/sc/source/ui/unoobj/exceldetect.cxx @@ -18,9 +18,9 @@ #include #include #include +#include using namespace com::sun::star; -using utl::MediaDescriptor; ScExcelBiffDetect::ScExcelBiffDetect() {} ScExcelBiffDetect::~ScExcelBiffDetect() {} @@ -129,15 +129,15 @@ bool isTemplate(std::u16string_view rType) OUString ScExcelBiffDetect::detect( uno::Sequence& lDescriptor ) { - MediaDescriptor aMediaDesc(lDescriptor); + comphelper::SequenceAsHashMap aMediaDesc(lDescriptor); OUString aType; - aMediaDesc[MediaDescriptor::PROP_TYPENAME] >>= aType; + aMediaDesc[utl::MediaDescriptor::PROP_TYPENAME] >>= aType; if (aType.isEmpty()) // Type is not given. We can't proceed. return OUString(); - aMediaDesc.addInputStream(); - uno::Reference xInStream(aMediaDesc[MediaDescriptor::PROP_INPUTSTREAM], uno::UNO_QUERY); + utl::MediaDescriptor::addInputStream(aMediaDesc); + uno::Reference xInStream(aMediaDesc[utl::MediaDescriptor::PROP_INPUTSTREAM], uno::UNO_QUERY); if (!xInStream.is()) // No input stream. return OUString(); @@ -149,7 +149,7 @@ OUString ScExcelBiffDetect::detect( uno::Sequence& lDescri // BIFF8 is expected to contain a stream named "Workbook". return OUString(); - aMediaDesc[MediaDescriptor::PROP_FILTERNAME] <<= isTemplate(aType) ? u"MS Excel 97 Vorlage/Template"_ustr : u"MS Excel 97"_ustr; + aMediaDesc[utl::MediaDescriptor::PROP_FILTERNAME] <<= isTemplate(aType) ? u"MS Excel 97 Vorlage/Template"_ustr : u"MS Excel 97"_ustr; } else if (aType == "calc_MS_Excel_95" || aType == "calc_MS_Excel_95_VorlageTemplate") @@ -158,7 +158,7 @@ OUString ScExcelBiffDetect::detect( uno::Sequence& lDescri if (!hasStream(xInStream, u"Book"_ustr)) return OUString(); - aMediaDesc[MediaDescriptor::PROP_FILTERNAME] <<= isTemplate(aType) ? u"MS Excel 95 Vorlage/Template"_ustr : u"MS Excel 95"_ustr; + aMediaDesc[utl::MediaDescriptor::PROP_FILTERNAME] <<= isTemplate(aType) ? u"MS Excel 95 Vorlage/Template"_ustr : u"MS Excel 95"_ustr; } else if (aType == "calc_MS_Excel_5095" || aType == "calc_MS_Excel_5095_VorlageTemplate") @@ -167,7 +167,7 @@ OUString ScExcelBiffDetect::detect( uno::Sequence& lDescri if (!hasStream(xInStream, u"Book"_ustr)) return OUString(); - aMediaDesc[MediaDescriptor::PROP_FILTERNAME] <<= isTemplate(aType) ? u"MS Excel 5.0/95 Vorlage/Template"_ustr : u"MS Excel 5.0/95"_ustr; + aMediaDesc[utl::MediaDescriptor::PROP_FILTERNAME] <<= isTemplate(aType) ? u"MS Excel 5.0/95 Vorlage/Template"_ustr : u"MS Excel 5.0/95"_ustr; } else if (aType == "calc_MS_Excel_40" || aType == "calc_MS_Excel_40_VorlageTemplate") @@ -176,7 +176,7 @@ OUString ScExcelBiffDetect::detect( uno::Sequence& lDescri if (!isExcel40(xInStream)) return OUString(); - aMediaDesc[MediaDescriptor::PROP_FILTERNAME] <<= isTemplate(aType) ? u"MS Excel 4.0 Vorlage/Template"_ustr : u"MS Excel 4.0"_ustr; + aMediaDesc[utl::MediaDescriptor::PROP_FILTERNAME] <<= isTemplate(aType) ? u"MS Excel 4.0 Vorlage/Template"_ustr : u"MS Excel 4.0"_ustr; } else diff --git a/sc/source/ui/unoobj/scdetect.cxx b/sc/source/ui/unoobj/scdetect.cxx index 4a34492207eb..cfd515b3e4bf 100644 --- a/sc/source/ui/unoobj/scdetect.cxx +++ b/sc/source/ui/unoobj/scdetect.cxx @@ -25,13 +25,13 @@ #include #include #include +#include #include #include #include #include using namespace ::com::sun::star; -using utl::MediaDescriptor; namespace { @@ -262,9 +262,9 @@ static bool lcl_MayBeDBase( SvStream& rStream ) OUString SAL_CALL ScFilterDetect::detect( uno::Sequence& lDescriptor ) { - MediaDescriptor aMediaDesc( lDescriptor ); - OUString aTypeName = aMediaDesc.getUnpackedValueOrDefault( MediaDescriptor::PROP_TYPENAME, OUString() ); - uno::Reference< io::XInputStream > xStream ( aMediaDesc[MediaDescriptor::PROP_INPUTSTREAM], uno::UNO_QUERY ); + comphelper::SequenceAsHashMap aMediaDesc(lDescriptor); + OUString aTypeName = aMediaDesc.getUnpackedValueOrDefault( utl::MediaDescriptor::PROP_TYPENAME, OUString() ); + uno::Reference< io::XInputStream > xStream ( aMediaDesc[utl::MediaDescriptor::PROP_INPUTSTREAM], uno::UNO_QUERY ); if ( !xStream.is() ) return OUString(); @@ -322,7 +322,7 @@ OUString SAL_CALL ScFilterDetect::detect( uno::Sequence& l if (!pFilter) return OUString(); - aMediaDesc[MediaDescriptor::PROP_FILTERNAME] <<= pFilter->GetName(); + aMediaDesc[utl::MediaDescriptor::PROP_FILTERNAME] <<= pFilter->GetName(); aMediaDesc >> lDescriptor; return aTypeName; } diff --git a/scripting/source/provider/BrowseNodeFactoryImpl.cxx b/scripting/source/provider/BrowseNodeFactoryImpl.cxx index 003cb999f520..5a975722f17e 100644 --- a/scripting/source/provider/BrowseNodeFactoryImpl.cxx +++ b/scripting/source/provider/BrowseNodeFactoryImpl.cxx @@ -31,6 +31,7 @@ #include #include +#include #include "BrowseNodeFactoryImpl.hxx" #include @@ -287,7 +288,7 @@ std::vector< Reference< browse::XBrowseNode > > getAllBrowseNodes( const Referen css::uno::Reference< css::frame::XController > xCurrentController = model->getCurrentController(); if( xCurrentController.is() ) { - utl::MediaDescriptor aMD( model->getArgs() ); + comphelper::SequenceAsHashMap aMD(model->getArgs()); bool bDefault = false; bool bHidden = aMD.getUnpackedValueOrDefault( utl::MediaDescriptor::PROP_HIDDEN, bDefault ); bool bPreview = aMD.getUnpackedValueOrDefault( utl::MediaDescriptor::PROP_PREVIEW, bDefault ); diff --git a/sd/qa/unit/SdrPdfImportTest.cxx b/sd/qa/unit/SdrPdfImportTest.cxx index f495b3d0f546..0111be40b293 100644 --- a/sd/qa/unit/SdrPdfImportTest.cxx +++ b/sd/qa/unit/SdrPdfImportTest.cxx @@ -11,9 +11,9 @@ #include #include +#include #include -#include #include #include #include @@ -224,7 +224,7 @@ CPPUNIT_TEST_FIXTURE(SdrPdfImportTest, testAnnotationsImportExport) { // save as PDF and check annotations uno::Reference xStorable(mxComponent, uno::UNO_QUERY); - utl::MediaDescriptor aMediaDescriptor; + comphelper::SequenceAsHashMap aMediaDescriptor; aMediaDescriptor[u"FilterName"_ustr] <<= u"writer_pdf_Export"_ustr; uno::Sequence aFilterData( comphelper::InitPropertySequence({ { "ExportBookmarks", uno::Any(true) } })); diff --git a/sd/source/ui/framework/factories/BasicToolBarFactory.cxx b/sd/source/ui/framework/factories/BasicToolBarFactory.cxx index 783678f00aa5..8904fd78a1d8 100644 --- a/sd/source/ui/framework/factories/BasicToolBarFactory.cxx +++ b/sd/source/ui/framework/factories/BasicToolBarFactory.cxx @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -44,7 +45,7 @@ BasicToolBarFactory::BasicToolBarFactory(const rtl::Reference<::sd::DrawControll { mxController = rxController; - utl::MediaDescriptor aDescriptor (mxController->getModel()->getArgs()); + comphelper::SequenceAsHashMap aDescriptor(mxController->getModel()->getArgs()); if ( ! aDescriptor.getUnpackedValueOrDefault( utl::MediaDescriptor::PROP_PREVIEW, false)) diff --git a/sd/source/ui/unoidl/sddetect.cxx b/sd/source/ui/unoidl/sddetect.cxx index ba1994708b1e..40dedb32f903 100644 --- a/sd/source/ui/unoidl/sddetect.cxx +++ b/sd/source/ui/unoidl/sddetect.cxx @@ -30,6 +30,7 @@ #include #include #include +#include #include using namespace ::com::sun::star; @@ -38,7 +39,6 @@ using namespace ::com::sun::star::io; using namespace ::com::sun::star::task; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::lang; -using utl::MediaDescriptor; SdFilterDetect::SdFilterDetect() { @@ -50,9 +50,9 @@ SdFilterDetect::~SdFilterDetect() OUString SAL_CALL SdFilterDetect::detect( Sequence< beans::PropertyValue >& lDescriptor ) { - MediaDescriptor aMediaDesc( lDescriptor ); - OUString aTypeName = aMediaDesc.getUnpackedValueOrDefault( MediaDescriptor::PROP_TYPENAME, OUString() ); - uno::Reference< io::XInputStream > xInStream ( aMediaDesc[MediaDescriptor::PROP_INPUTSTREAM], uno::UNO_QUERY ); + comphelper::SequenceAsHashMap aMediaDesc(lDescriptor); + OUString aTypeName = aMediaDesc.getUnpackedValueOrDefault( utl::MediaDescriptor::PROP_TYPENAME, OUString() ); + uno::Reference< io::XInputStream > xInStream ( aMediaDesc[utl::MediaDescriptor::PROP_INPUTSTREAM], uno::UNO_QUERY ); if ( !xInStream.is() ) return OUString(); @@ -88,7 +88,7 @@ OUString SAL_CALL SdFilterDetect::detect( Sequence< beans::PropertyValue >& lDes { pInStrm->Seek( STREAM_SEEK_TO_BEGIN ); - const OUString aFileName( aMediaDesc.getUnpackedValueOrDefault( MediaDescriptor::PROP_URL, OUString() ) ); + const OUString aFileName( aMediaDesc.getUnpackedValueOrDefault( utl::MediaDescriptor::PROP_URL, OUString() ) ); GraphicDescriptor aDesc( *pInStrm, &aFileName ); if( !aDesc.Detect() ) { diff --git a/sfx2/source/appl/fileobj.cxx b/sfx2/source/appl/fileobj.cxx index 1e8517acddb6..8712b651342b 100644 --- a/sfx2/source/appl/fileobj.cxx +++ b/sfx2/source/appl/fileobj.cxx @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -211,7 +212,7 @@ static OUString impl_getFilter( const OUString& _rURL ) css::uno::UNO_QUERY ); if ( xTypeDetection.is() ) { - utl::MediaDescriptor aDescr; + comphelper::SequenceAsHashMap aDescr; aDescr[ utl::MediaDescriptor::PROP_URL ] <<= _rURL; css::uno::Sequence< css::beans::PropertyValue > aDescrList = aDescr.getAsConstPropertyValueList(); diff --git a/sfx2/source/bastyp/fltfnc.cxx b/sfx2/source/bastyp/fltfnc.cxx index 73665f295b9c..614dbe5903d1 100644 --- a/sfx2/source/bastyp/fltfnc.cxx +++ b/sfx2/source/bastyp/fltfnc.cxx @@ -368,7 +368,7 @@ ErrCode SfxFilterMatcher::GuessFilterControlDefaultUI( SfxMedium& rMedium, std: // stream exists => deep detection (with preselection ... if possible) if (xInStream.is()) { - utl::MediaDescriptor aDescriptor; + comphelper::SequenceAsHashMap aDescriptor; aDescriptor[utl::MediaDescriptor::PROP_URL ] <<= sURL; aDescriptor[utl::MediaDescriptor::PROP_INPUTSTREAM ] <<= xInStream; diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx index ec456a103d58..5af344198a03 100644 --- a/sfx2/source/control/unoctitm.cxx +++ b/sfx2/source/control/unoctitm.cxx @@ -72,11 +72,11 @@ #include #include #include +#include #include #include #include -#include #include #include @@ -237,7 +237,7 @@ void SAL_CALL SfxOfficeDispatch::dispatch( const css::util::URL& aURL, const css #if HAVE_FEATURE_JAVA std::unique_ptr< css::uno::ContextLayer > layer(EnsureJavaContext()); #endif - utl::MediaDescriptor aDescriptor(aArgs); + comphelper::SequenceAsHashMap aDescriptor(aArgs); bool bOnMainThread = aDescriptor.getUnpackedValueOrDefault(u"OnMainThread"_ustr, false); if (bOnMainThread) { diff --git a/sfx2/source/doc/DocumentMetadataAccess.cxx b/sfx2/source/doc/DocumentMetadataAccess.cxx index c5de76afe89c..5bcc00cdafc5 100644 --- a/sfx2/source/doc/DocumentMetadataAccess.cxx +++ b/sfx2/source/doc/DocumentMetadataAccess.cxx @@ -44,6 +44,7 @@ #include #include #include +#include #include #include #include @@ -1254,12 +1255,12 @@ DocumentMetadataAccess::loadMetadataFromMedium( const uno::Sequence< beans::PropertyValue > & i_rMedium) { uno::Reference xIn; - utl::MediaDescriptor md(i_rMedium); + comphelper::SequenceAsHashMap md(i_rMedium); OUString URL; md[ utl::MediaDescriptor::PROP_URL ] >>= URL; OUString BaseURL; md[ utl::MediaDescriptor::PROP_DOCUMENTBASEURL ] >>= BaseURL; - if (md.addInputStream()) { + if (utl::MediaDescriptor::addInputStream(md)) { md[ utl::MediaDescriptor::PROP_INPUTSTREAM ] >>= xIn; } if (!xIn.is() && URL.isEmpty()) { @@ -1311,7 +1312,7 @@ void SAL_CALL DocumentMetadataAccess::storeMetadataToMedium( const uno::Sequence< beans::PropertyValue > & i_rMedium) { - utl::MediaDescriptor md(i_rMedium); + comphelper::SequenceAsHashMap md(i_rMedium); OUString URL; md[ utl::MediaDescriptor::PROP_URL ] >>= URL; if (URL.isEmpty()) { @@ -1337,8 +1338,7 @@ DocumentMetadataAccess::storeMetadataToMedium( "cannot get Storage"_ustr, *this); } // set MIME type of the storage - utl::MediaDescriptor::const_iterator iter - = md.find(utl::MediaDescriptor::PROP_MEDIATYPE); + auto iter = md.find(utl::MediaDescriptor::PROP_MEDIATYPE); if (iter != md.end()) { uno::Reference< beans::XPropertySet > xProps(xStorage, uno::UNO_QUERY_THROW); diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx b/sfx2/source/doc/SfxDocumentMetaData.cxx index 4a3cb8d8c057..c80c332c6788 100644 --- a/sfx2/source/doc/SfxDocumentMetaData.cxx +++ b/sfx2/source/doc/SfxDocumentMetaData.cxx @@ -71,6 +71,7 @@ #include #include #include +#include #include #include #include @@ -2051,13 +2052,13 @@ SfxDocumentMetaData::loadFromMedium(const OUString & URL, const css::uno::Sequence< css::beans::PropertyValue > & Medium) { css::uno::Reference xIn; - utl::MediaDescriptor md(Medium); + comphelper::SequenceAsHashMap md(Medium); // if we have a URL parameter, it replaces the one in the media descriptor if (!URL.isEmpty()) { md[ utl::MediaDescriptor::PROP_URL ] <<= URL; md[ utl::MediaDescriptor::PROP_READONLY ] <<= true; } - if (md.addInputStream()) { + if (utl::MediaDescriptor::addInputStream(md)) { md[ utl::MediaDescriptor::PROP_INPUTSTREAM ] >>= xIn; } css::uno::Reference xStorage; @@ -2092,7 +2093,7 @@ void SAL_CALL SfxDocumentMetaData::storeToMedium(const OUString & URL, const css::uno::Sequence< css::beans::PropertyValue > & Medium) { - utl::MediaDescriptor md(Medium); + comphelper::SequenceAsHashMap md(Medium); if (!URL.isEmpty()) { md[ utl::MediaDescriptor::PROP_URL ] <<= URL; } @@ -2107,8 +2108,7 @@ SfxDocumentMetaData::storeToMedium(const OUString & URL, *this); } // set MIME type of the storage - utl::MediaDescriptor::const_iterator iter - = md.find(utl::MediaDescriptor::PROP_MEDIATYPE); + auto iter = md.find(utl::MediaDescriptor::PROP_MEDIATYPE); if (iter != md.end()) { css::uno::Reference< css::beans::XPropertySet > xProps(xStorage, css::uno::UNO_QUERY_THROW); diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 30a556090044..ba9cf0e9c2d3 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -2931,9 +2931,9 @@ void SfxMedium::GetLockingStream_Impl() return; // open the original document - utl::MediaDescriptor aMedium(TransformItems(SID_OPENDOC, GetItemSet()).getAsConstPropertyValueList()); + comphelper::SequenceAsHashMap aMedium(TransformItems(SID_OPENDOC, GetItemSet())); - aMedium.addInputStreamOwnLock(); + utl::MediaDescriptor::addInputStreamOwnLock(aMedium); uno::Reference< io::XInputStream > xInputStream; aMedium[utl::MediaDescriptor::PROP_STREAM] >>= pImpl->m_xLockingStream; @@ -3015,7 +3015,7 @@ void SfxMedium::GetMedium_Impl() } else { - utl::MediaDescriptor aMedium(TransformItems(SID_OPENDOC, GetItemSet()).getAsConstPropertyValueList()); + comphelper::SequenceAsHashMap aMedium(TransformItems(SID_OPENDOC, GetItemSet())); if ( pImpl->m_xLockingStream.is() && !bFromTempFile ) { @@ -3028,12 +3028,12 @@ void SfxMedium::GetMedium_Impl() { aMedium[utl::MediaDescriptor::PROP_URL] <<= aFileName; aMedium.erase( utl::MediaDescriptor::PROP_READONLY ); - aMedium.addInputStream(); + utl::MediaDescriptor::addInputStream(aMedium); } else if ( GetURLObject().GetProtocol() == INetProtocol::File ) { // use the special locking approach only for file URLs - aMedium.addInputStreamOwnLock(); + utl::MediaDescriptor::addInputStreamOwnLock(aMedium); } else { @@ -3043,7 +3043,7 @@ void SfxMedium::GetMedium_Impl() { aMedium[utl::MediaDescriptor::PROP_AUTHENTICATIONHANDLER] <<= GetInteractionHandler( true ); } - aMedium.addInputStream(); + utl::MediaDescriptor::addInputStream(aMedium); } // the ReadOnly property set in aMedium is ignored // the check is done in LockOrigFileOnDemand() for file and non-file URLs diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index 3659b5880f6c..bf3d6f945641 100644 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -54,6 +54,7 @@ #include #include #include +#include #include #include @@ -69,7 +70,6 @@ #include #include -#include #include #include #include @@ -1978,7 +1978,7 @@ bool SfxObjectShell::IsContinueImportOnFilterExceptions() return false; } - if (utl::MediaDescriptor desc(pMedium->GetArgs()); + if (comphelper::SequenceAsHashMap desc(pMedium->GetArgs()); !desc.getUnpackedValueOrDefault(u"RepairAllowed"_ustr, true)) { mbContinueImportOnFilterExceptions = no; diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index 76eaf27b73ef..8d09fe433f63 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -3638,7 +3638,7 @@ bool SfxObjectShell::SaveAsChildren( SfxMedium& rMedium ) } bool AutoSaveEvent = false; - utl::MediaDescriptor lArgs(rMedium.GetArgs()); + comphelper::SequenceAsHashMap lArgs(rMedium.GetArgs()); lArgs[utl::MediaDescriptor::PROP_AUTOSAVEEVENT] >>= AutoSaveEvent; if ( pImpl->mxObjectContainer ) diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 1cac84790f4f..c10e37e680c4 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -136,8 +136,8 @@ #include #include #include +#include #include -#include #include @@ -1761,7 +1761,7 @@ void SAL_CALL SfxBaseModel::storeAsURL( const OUString& rURL SfxSaveGuard aSaveGuard(this, m_pData.get()); - utl::MediaDescriptor aDescriptor(rArgs); + comphelper::SequenceAsHashMap aDescriptor(rArgs); bool bOnMainThread = aDescriptor.getUnpackedValueOrDefault(u"OnMainThread"_ustr, false); if (bOnMainThread) { @@ -1809,7 +1809,7 @@ void SAL_CALL SfxBaseModel::storeToURL( const OUString& rURL SfxSaveGuard aSaveGuard(this, m_pData.get()); try { - utl::MediaDescriptor aDescriptor(rArgs); + comphelper::SequenceAsHashMap aDescriptor(rArgs); bool bOnMainThread = aDescriptor.getUnpackedValueOrDefault(u"OnMainThread"_ustr, false); if (bOnMainThread) vcl::solarthread::syncExecute([this, rURL, rArgs]() { impl_store(rURL, rArgs, true); }); diff --git a/starmath/source/smdetect.cxx b/starmath/source/smdetect.cxx index 56e2157e55c3..899dbcccf8b1 100644 --- a/starmath/source/smdetect.cxx +++ b/starmath/source/smdetect.cxx @@ -26,6 +26,7 @@ #include #include #include +#include #include "eqnolefilehdr.hxx" @@ -35,7 +36,6 @@ using namespace ::com::sun::star::io; using namespace ::com::sun::star::task; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::lang; -using utl::MediaDescriptor; SmFilterDetect::SmFilterDetect() { @@ -47,8 +47,8 @@ SmFilterDetect::~SmFilterDetect() OUString SAL_CALL SmFilterDetect::detect( Sequence< PropertyValue >& lDescriptor ) { - MediaDescriptor aMediaDesc( lDescriptor ); - uno::Reference< io::XInputStream > xInStream ( aMediaDesc[MediaDescriptor::PROP_INPUTSTREAM], uno::UNO_QUERY ); + comphelper::SequenceAsHashMap aMediaDesc(lDescriptor); + uno::Reference< io::XInputStream > xInStream ( aMediaDesc[utl::MediaDescriptor::PROP_INPUTSTREAM], uno::UNO_QUERY ); if ( !xInStream.is() ) return OUString(); diff --git a/starmath/source/unofilter.cxx b/starmath/source/unofilter.cxx index 28bc21b89cd1..0f3a970f36a8 100644 --- a/starmath/source/unofilter.cxx +++ b/starmath/source/unofilter.cxx @@ -16,6 +16,7 @@ #include "mathtype.hxx" #include #include +#include using namespace ::com::sun::star; @@ -51,8 +52,8 @@ sal_Bool MathTypeFilter::filter(const uno::Sequence& rDesc bool bSuccess = false; try { - utl::MediaDescriptor aMediaDesc(rDescriptor); - aMediaDesc.addInputStream(); + comphelper::SequenceAsHashMap aMediaDesc(rDescriptor); + utl::MediaDescriptor::addInputStream(aMediaDesc); uno::Reference xInputStream; aMediaDesc[utl::MediaDescriptor::PROP_INPUTSTREAM] >>= xInputStream; std::unique_ptr pStream(utl::UcbStreamHelper::CreateStream(xInputStream)); diff --git a/svx/qa/unit/unodraw.cxx b/svx/qa/unit/unodraw.cxx index 853715dfed83..b52d64ec0140 100644 --- a/svx/qa/unit/unodraw.cxx +++ b/svx/qa/unit/unodraw.cxx @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -31,7 +32,6 @@ #include #include #include -#include #include #include @@ -197,7 +197,7 @@ CPPUNIT_TEST_FIXTURE(UnodrawTest, testPngExport) uno::Reference xStorable(mxComponent, uno::UNO_QUERY_THROW); SvMemoryStream aStream; uno::Reference xOut = new utl::OOutputStreamWrapper(aStream); - utl::MediaDescriptor aMediaDescriptor; + comphelper::SequenceAsHashMap aMediaDescriptor; aMediaDescriptor[u"FilterName"_ustr] <<= u"impress_png_Export"_ustr; aMediaDescriptor[u"FilterOptions"_ustr] <<= u"{\"PixelHeight\":{\"type\":\"long\",\"value\":\"192\"}," diff --git a/sw/qa/core/undo/undo.cxx b/sw/qa/core/undo/undo.cxx index 4ac1f0fe251a..3877bb287dd0 100644 --- a/sw/qa/core/undo/undo.cxx +++ b/sw/qa/core/undo/undo.cxx @@ -9,7 +9,7 @@ #include -#include +#include #include #include @@ -49,7 +49,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreUndoTest, testTextboxCutSave) // Save. uno::Reference xStorable(mxComponent, uno::UNO_QUERY); - utl::MediaDescriptor aMediaDescriptor; + comphelper::SequenceAsHashMap aMediaDescriptor; aMediaDescriptor[u"FilterName"_ustr] <<= u"Office Open XML Text"_ustr; // Without the accompanying fix in place, this test would have failed with: diff --git a/sw/qa/extras/globalfilter/globalfilter.cxx b/sw/qa/extras/globalfilter/globalfilter.cxx index 793d98727aec..e8a90fb869ea 100644 --- a/sw/qa/extras/globalfilter/globalfilter.cxx +++ b/sw/qa/extras/globalfilter/globalfilter.cxx @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -37,7 +38,6 @@ #include #include #include -#include #include namespace @@ -999,7 +999,7 @@ void Test::testODF13() // FIXME: it's not possible to use 'reload' here because the validation fails with // Error: unexpected attribute "loext:contextual-spacing" - utl::MediaDescriptor aMediaDescriptor; + comphelper::SequenceAsHashMap aMediaDescriptor; aMediaDescriptor[u"FilterName"_ustr] <<= u"writer8"_ustr; uno::Reference const xStorable(mxComponent, uno::UNO_QUERY); @@ -1261,7 +1261,7 @@ CPPUNIT_TEST_FIXTURE(Test, testListLabelPDFExport) uno::Reference(getParagraph(3), uno::UNO_QUERY_THROW)->setPropertyValue(u"NumberingLevel"_ustr, uno::Any(sal_Int16(2))); // check PDF export of the list items (label in particular) - utl::MediaDescriptor aMediaDescriptor; + comphelper::SequenceAsHashMap aMediaDescriptor; aMediaDescriptor[u"FilterName"_ustr] <<= u"writer_pdf_Export"_ustr; // Enable PDF/UA uno::Sequence aFilterData( @@ -1668,7 +1668,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTableOfContentLinksHaveContentSet) pWrtShell->UpdateTableOf(*pTOX); // Export as PDF - utl::MediaDescriptor aMediaDescriptor; + comphelper::SequenceAsHashMap aMediaDescriptor; aMediaDescriptor[u"FilterName"_ustr] <<= u"writer_pdf_Export"_ustr; // Enable PDF/UA uno::Sequence aFilterData( @@ -1732,7 +1732,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf143311) CPPUNIT_ASSERT_EQUAL(true, getProperty(getStyles(u"FrameStyles"_ustr)->getByName(u"Formula"_ustr), u"Decorative"_ustr)); // check PDF export - utl::MediaDescriptor aMediaDescriptor; + comphelper::SequenceAsHashMap aMediaDescriptor; aMediaDescriptor[u"FilterName"_ustr] <<= u"writer_pdf_Export"_ustr; // Enable PDF/UA uno::Sequence aFilterData( diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx index 66f433c21c44..a55a0a9fbde0 100644 --- a/sw/qa/extras/tiledrendering/tiledrendering.cxx +++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx @@ -48,7 +48,6 @@ #include #include #include -#include #include #include #include @@ -2905,12 +2904,11 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testRedlineNotificationDuringSave) setupLibreOfficeKitViewCallback(pWrtShell->GetSfxViewShell()); // Save the document. - utl::MediaDescriptor aMediaDescriptor; - aMediaDescriptor[u"FilterName"_ustr] <<= u"writer8"_ustr; uno::Reference xStorable(mxComponent, uno::UNO_QUERY); // Without the accompanying fix in place, this test would have never returned due to an infinite // loop while sending not needed LOK notifications for redline changes during save. - xStorable->storeToURL(maTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList()); + xStorable->storeToURL(maTempFile.GetURL(), + { comphelper::makePropertyValue(u"FilterName"_ustr, u"writer8"_ustr) }); } CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testHyperlink) diff --git a/sw/qa/extras/unowriter/unowriter.cxx b/sw/qa/extras/unowriter/unowriter.cxx index 9161980a6cbe..916342a4e226 100644 --- a/sw/qa/extras/unowriter/unowriter.cxx +++ b/sw/qa/extras/unowriter/unowriter.cxx @@ -51,7 +51,6 @@ #include #include #include -#include #include #include @@ -1548,7 +1547,7 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, testTdf164921) uno::UNO_QUERY); xListStyle->setName(sChangedListStyle); - utl::MediaDescriptor aMediaDescriptor; + comphelper::SequenceAsHashMap aMediaDescriptor; aMediaDescriptor[u"FilterName"_ustr] <<= u"writer8"_ustr; uno::Reference const xStorable(mxComponent, uno::UNO_QUERY); xStorable->storeToURL(maTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList()); diff --git a/sw/source/core/docnode/retrieveinputstream.cxx b/sw/source/core/docnode/retrieveinputstream.cxx index 53f8b6410ec3..7f448539c4c7 100644 --- a/sw/source/core/docnode/retrieveinputstream.cxx +++ b/sw/source/core/docnode/retrieveinputstream.cxx @@ -20,6 +20,7 @@ #include #include +#include #include #include #include @@ -60,9 +61,9 @@ void SwAsyncRetrieveInputStreamThread::threadFunction() comphelper::makePropertyValue(u"URL"_ustr, mrLinkedURL), comphelper::makePropertyValue(u"Referer"_ustr, mrReferer) }; - utl::MediaDescriptor aMedium( xProps ); + comphelper::SequenceAsHashMap aMedium(xProps); - aMedium.addInputStream(); + utl::MediaDescriptor::addInputStream(aMedium); css::uno::Reference xInputStream; aMedium[utl::MediaDescriptor::PROP_INPUTSTREAM] >>= xInputStream; @@ -78,7 +79,7 @@ void SwAsyncRetrieveInputStreamThread::threadFunction() SwRetrievedInputStreamDataManager::GetManager().PushData( mnDataKey, xInputStream, - aMedium.isStreamReadOnly() ); + utl::MediaDescriptor::isStreamReadOnly(aMedium) ); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/layout/dumpfilter.cxx b/sw/source/core/layout/dumpfilter.cxx index 28b667b0a7b6..b5b0e7676114 100644 --- a/sw/source/core/layout/dumpfilter.cxx +++ b/sw/source/core/layout/dumpfilter.cxx @@ -15,6 +15,7 @@ #include #include +#include #include #include @@ -81,7 +82,7 @@ namespace sw { bool bRet = false; - utl::MediaDescriptor aMediaDesc = aDescriptor; + comphelper::SequenceAsHashMap aMediaDesc = aDescriptor; // Get the output stream uno::Reference< io::XOutputStream > xOut = aMediaDesc.getUnpackedValueOrDefault( diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx index f78a2c86f590..6d5aee41481e 100644 --- a/sw/source/core/unocore/unocrsrhelper.cxx +++ b/sw/source/core/unocore/unocrsrhelper.cxx @@ -1045,7 +1045,7 @@ void InsertFile(SwUnoCursor* pUnoCursor, const OUString& rURL, std::unique_ptr pMed; SwDoc& rDoc = pUnoCursor->GetDoc(); - utl::MediaDescriptor aMediaDescriptor( rOptions ); + comphelper::SequenceAsHashMap aMediaDescriptor(rOptions); OUString sFileName = rURL; OUString sFilterName, sFilterOptions, sPassword, sBaseURL; uno::Reference < io::XStream > xStream; diff --git a/sw/source/filter/html/htmlplug.cxx b/sw/source/filter/html/htmlplug.cxx index 3981820b3b37..3a10d1728def 100644 --- a/sw/source/filter/html/htmlplug.cxx +++ b/sw/source/filter/html/htmlplug.cxx @@ -45,7 +45,6 @@ #include #include -#include #include #include #include @@ -74,6 +73,7 @@ #include #include #include +#include #include #include #include @@ -1574,7 +1574,7 @@ static bool TrySaveFormulaAsPDF(SwHTMLWriter& rWrt, const SwFrameFormat& rFrameF Graphic aGraphic(xTextContent->getReplacementGraphic()); OUString aFileName = lcl_CalculateFileName(rWrt.GetOrigFileName(), aGraphic, u"pdf"); - utl::MediaDescriptor aDescr; + comphelper::SequenceAsHashMap aDescr; aDescr[u"FilterName"_ustr] <<= u"math_pdf_Export"_ustr; // Properties from starmath/inc/unomodel.hxx aDescr[u"FilterData"_ustr] <<= comphelper::InitPropertySequence({ @@ -1631,7 +1631,7 @@ SwHTMLWriter& OutHTML_FrameFormatOLENodeGrf( SwHTMLWriter& rWrt, const SwFrameFo // FIXME: exception for the simplest test document, too SvMemoryStream aStream; uno::Reference xOutputStream(new utl::OStreamWrapper(aStream)); - utl::MediaDescriptor aMediaDescriptor; + comphelper::SequenceAsHashMap aMediaDescriptor; aMediaDescriptor[u"FilterName"_ustr] <<= aFilter; aMediaDescriptor[u"FilterOptions"_ustr] <<= u"SkipHeaderFooter"_ustr; aMediaDescriptor[u"OutputStream"_ustr] <<= xOutputStream; diff --git a/sw/source/filter/indexing/IndexingExportFilter.cxx b/sw/source/filter/indexing/IndexingExportFilter.cxx index 6ac3b6e3a88b..b97c32c9a383 100644 --- a/sw/source/filter/indexing/IndexingExportFilter.cxx +++ b/sw/source/filter/indexing/IndexingExportFilter.cxx @@ -15,6 +15,7 @@ #include #include +#include #include #include @@ -27,7 +28,7 @@ sal_Bool IndexingExportFilter::filter(const uno::Sequence& { bool bReturn = false; - utl::MediaDescriptor aMediaDesc = aDescriptor; + comphelper::SequenceAsHashMap aMediaDesc = aDescriptor; // Actually get the SwRootFrame to call dumpAsXml auto pXTextDocument = comphelper::getFromUnoTunnel(m_xSourceDocument); diff --git a/sw/source/filter/ww8/docxexportfilter.cxx b/sw/source/filter/ww8/docxexportfilter.cxx index 8ea56f2f3661..c2ad2d0756e2 100644 --- a/sw/source/filter/ww8/docxexportfilter.cxx +++ b/sw/source/filter/ww8/docxexportfilter.cxx @@ -28,6 +28,7 @@ #include #include +#include #include using namespace ::comphelper; diff --git a/sw/source/filter/ww8/rtfexportfilter.cxx b/sw/source/filter/ww8/rtfexportfilter.cxx index 755189950490..ea3d138e80de 100644 --- a/sw/source/filter/ww8/rtfexportfilter.cxx +++ b/sw/source/filter/ww8/rtfexportfilter.cxx @@ -25,6 +25,7 @@ #include #include +#include #include #include #include @@ -40,7 +41,7 @@ RtfExportFilter::~RtfExportFilter() = default; sal_Bool RtfExportFilter::filter(const uno::Sequence& aDescriptor) { - utl::MediaDescriptor aMediaDesc = aDescriptor; + comphelper::SequenceAsHashMap aMediaDesc = aDescriptor; uno::Reference xStream = aMediaDesc.getUnpackedValueOrDefault( utl::MediaDescriptor::PROP_STREAMFOROUTPUT, uno::Reference()); std::unique_ptr pStream = utl::UcbStreamHelper::CreateStream(xStream, true); diff --git a/sw/source/ui/uno/swdetect.cxx b/sw/source/ui/uno/swdetect.cxx index d087cfeb8e4b..8dff2ae698f5 100644 --- a/sw/source/ui/uno/swdetect.cxx +++ b/sw/source/ui/uno/swdetect.cxx @@ -19,6 +19,7 @@ #include "swdetect.hxx" +#include #include #include #include @@ -33,7 +34,6 @@ using namespace ::com::sun::star::io; using namespace ::com::sun::star::task; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::lang; -using utl::MediaDescriptor; SwFilterDetect::SwFilterDetect() { @@ -45,9 +45,9 @@ SwFilterDetect::~SwFilterDetect() OUString SAL_CALL SwFilterDetect::detect( Sequence< PropertyValue >& lDescriptor ) { - MediaDescriptor aMediaDesc( lDescriptor ); - OUString aTypeName = aMediaDesc.getUnpackedValueOrDefault( MediaDescriptor::PROP_TYPENAME, OUString() ); - uno::Reference< io::XInputStream > xInStream ( aMediaDesc[MediaDescriptor::PROP_INPUTSTREAM], uno::UNO_QUERY ); + comphelper::SequenceAsHashMap aMediaDesc(lDescriptor); + OUString aTypeName = aMediaDesc.getUnpackedValueOrDefault( utl::MediaDescriptor::PROP_TYPENAME, OUString() ); + uno::Reference< io::XInputStream > xInStream ( aMediaDesc[utl::MediaDescriptor::PROP_INPUTSTREAM], uno::UNO_QUERY ); if ( !xInStream.is() ) return OUString(); diff --git a/sw/source/writerfilter/dmapper/DomainMapper.cxx b/sw/source/writerfilter/dmapper/DomainMapper.cxx index c9598ebad25f..c43a0965882a 100644 --- a/sw/source/writerfilter/dmapper/DomainMapper.cxx +++ b/sw/source/writerfilter/dmapper/DomainMapper.cxx @@ -78,11 +78,11 @@ #include #include #include +#include #include #include #include #include -#include #include "TextEffectsHandler.hxx" #include "ThemeColorHandler.hxx" @@ -116,7 +116,7 @@ DomainMapper::DomainMapper( const uno::Reference< uno::XComponentContext >& xCon rtl::Reference const& xModel, bool bRepairStorage, SourceDocumentType eDocumentType, - utl::MediaDescriptor const & rMediaDesc) : + comphelper::SequenceAsHashMap const & rMediaDesc) : LoggedProperties("DomainMapper"), LoggedTable("DomainMapper"), LoggedStream("DomainMapper"), diff --git a/sw/source/writerfilter/dmapper/DomainMapper.hxx b/sw/source/writerfilter/dmapper/DomainMapper.hxx index f63f474951bc..f5d5c7a1a91c 100644 --- a/sw/source/writerfilter/dmapper/DomainMapper.hxx +++ b/sw/source/writerfilter/dmapper/DomainMapper.hxx @@ -51,9 +51,9 @@ namespace com::sun::star{ } } -namespace utl +namespace comphelper { -class MediaDescriptor; +class SequenceAsHashMap; } typedef std::vector PropertyValueVector_t; @@ -80,7 +80,7 @@ public: rtl::Reference const& xModel, bool bRepairStorage, SourceDocumentType eDocumentType, - utl::MediaDescriptor const & rMediaDesc); + comphelper::SequenceAsHashMap const & rMediaDesc); virtual ~DomainMapper() override; virtual void setDocumentReference(writerfilter::ooxml::OOXMLDocument* pDocument) override; diff --git a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx index 8d461f0a4c12..89b1a2b4da2b 100644 --- a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx +++ b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx @@ -353,7 +353,7 @@ DomainMapper_Impl::DomainMapper_Impl( uno::Reference xContext, rtl::Reference const& xModel, SourceDocumentType eDocumentType, - utl::MediaDescriptor const & rMediaDesc) : + comphelper::SequenceAsHashMap const & rMediaDesc) : m_eDocumentType( eDocumentType ), m_rDMapper( rDMapper ), m_pOOXMLDocument(nullptr), diff --git a/sw/source/writerfilter/dmapper/DomainMapper_Impl.hxx b/sw/source/writerfilter/dmapper/DomainMapper_Impl.hxx index 79fcc0ba1937..97ed342c2293 100644 --- a/sw/source/writerfilter/dmapper/DomainMapper_Impl.hxx +++ b/sw/source/writerfilter/dmapper/DomainMapper_Impl.hxx @@ -723,7 +723,7 @@ public: css::uno::Reference < css::uno::XComponentContext > xContext, rtl::Reference< SwXTextDocument > const& xModel, SourceDocumentType eDocumentType, - utl::MediaDescriptor const & rMediaDesc); + comphelper::SequenceAsHashMap const & rMediaDesc); ~DomainMapper_Impl(); void setDocumentReference(writerfilter::ooxml::OOXMLDocument* pDocument) { if (!m_pOOXMLDocument) m_pOOXMLDocument = pDocument; }; diff --git a/sw/source/writerfilter/dmapper/OLEHandler.cxx b/sw/source/writerfilter/dmapper/OLEHandler.cxx index d48c26e3b1a6..94a8597a68aa 100644 --- a/sw/source/writerfilter/dmapper/OLEHandler.cxx +++ b/sw/source/writerfilter/dmapper/OLEHandler.cxx @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include #include @@ -226,7 +226,7 @@ void OLEHandler::importStream(const uno::Reference& xCom xImporter->setTargetDocument( xEmbeddedObject ); // Import the input stream. - utl::MediaDescriptor aMediaDescriptor; + comphelper::SequenceAsHashMap aMediaDescriptor; aMediaDescriptor[u"InputStream"_ustr] <<= m_xInputStream; uno::Reference xFilter(xInterface, uno::UNO_QUERY); xFilter->filter(aMediaDescriptor.getAsConstPropertyValueList()); diff --git a/sw/source/writerfilter/dmapper/domainmapperfactory.cxx b/sw/source/writerfilter/dmapper/domainmapperfactory.cxx index 9ea34614ea6a..7fb3527d5fed 100644 --- a/sw/source/writerfilter/dmapper/domainmapperfactory.cxx +++ b/sw/source/writerfilter/dmapper/domainmapperfactory.cxx @@ -9,6 +9,7 @@ #include "DomainMapper.hxx" #include "TagLogger.hxx" +#include #include namespace writerfilter::dmapper @@ -18,7 +19,7 @@ DomainMapperFactory::createMapper(css::uno::Reference const& xInputStream, rtl::Reference const& xModel, bool bRepairStorage, SourceDocumentType eDocumentType, - utl::MediaDescriptor const& rMediaDesc) + comphelper::SequenceAsHashMap const& rMediaDesc) { #ifdef DBG_UTIL OUString sURL diff --git a/sw/source/writerfilter/filter/RtfFilter.cxx b/sw/source/writerfilter/filter/RtfFilter.cxx index 509dedd59c22..88a3342ec8b9 100644 --- a/sw/source/writerfilter/filter/RtfFilter.cxx +++ b/sw/source/writerfilter/filter/RtfFilter.cxx @@ -114,12 +114,12 @@ sal_Bool RtfFilter::filter(const uno::Sequence& rDescripto try { - utl::MediaDescriptor aMediaDesc(rDescriptor); + comphelper::SequenceAsHashMap aMediaDesc(rDescriptor); bool bRepairStorage = aMediaDesc.getUnpackedValueOrDefault(u"RepairPackage"_ustr, false); bool bIsNewDoc = !aMediaDesc.getUnpackedValueOrDefault(u"InsertMode"_ustr, false); uno::Reference xInputStream; - aMediaDesc.addInputStream(); + utl::MediaDescriptor::addInputStream(aMediaDesc); aMediaDesc[utl::MediaDescriptor::PROP_INPUTSTREAM] >>= xInputStream; // If this is set, write to this file, instead of the real document during paste. diff --git a/sw/source/writerfilter/filter/WriterFilter.cxx b/sw/source/writerfilter/filter/WriterFilter.cxx index f0c26c738ce9..1331789d29cb 100644 --- a/sw/source/writerfilter/filter/WriterFilter.cxx +++ b/sw/source/writerfilter/filter/WriterFilter.cxx @@ -45,6 +45,7 @@ #include #include #include +#include #include #include #include @@ -164,7 +165,7 @@ sal_Bool WriterFilter::filter(const uno::Sequence& rDescri comphelper::ScopeGuard g([this] { m_xDstDoc->setPropertyValue(u"UndocumentedWriterfilterHack"_ustr, uno::Any(false)); }); - utl::MediaDescriptor aMediaDesc(rDescriptor); + comphelper::SequenceAsHashMap aMediaDesc(rDescriptor); bool bRepairStorage = aMediaDesc.getUnpackedValueOrDefault(u"RepairPackage"_ustr, false); bool bSkipImages = aMediaDesc.getUnpackedValueOrDefault(u"FilterOptions"_ustr, OUString()) == "SkipImages"; diff --git a/sw/source/writerfilter/inc/dmapper/DomainMapperFactory.hxx b/sw/source/writerfilter/inc/dmapper/DomainMapperFactory.hxx index 46a5aab23dd2..ddff7e66b6d0 100644 --- a/sw/source/writerfilter/inc/dmapper/DomainMapperFactory.hxx +++ b/sw/source/writerfilter/inc/dmapper/DomainMapperFactory.hxx @@ -17,9 +17,9 @@ #include class SwXTextDocument; -namespace utl +namespace comphelper { -class MediaDescriptor; +class SequenceAsHashMap; } namespace writerfilter::dmapper @@ -38,7 +38,7 @@ public: createMapper(css::uno::Reference const& xContext, css::uno::Reference const& xInputStream, rtl::Reference const& xModel, bool bRepairStorage, - SourceDocumentType eDocumentType, utl::MediaDescriptor const& rMediaDesc); + SourceDocumentType eDocumentType, comphelper::SequenceAsHashMap const& rMediaDesc); }; // export just for test diff --git a/sw/source/writerfilter/inc/rtftok/RTFDocument.hxx b/sw/source/writerfilter/inc/rtftok/RTFDocument.hxx index a19f671162c2..52bb12d0df15 100644 --- a/sw/source/writerfilter/inc/rtftok/RTFDocument.hxx +++ b/sw/source/writerfilter/inc/rtftok/RTFDocument.hxx @@ -14,7 +14,8 @@ #include #include #include -#include +#include +#include class SwXTextDocument; @@ -41,7 +42,7 @@ public: rtl::Reference const& xDstDoc, css::uno::Reference const& xFrame, css::uno::Reference const& xStatusIndicator, - const utl::MediaDescriptor& rMediaDescriptor); + const comphelper::SequenceAsHashMap& rMediaDescriptor); }; } // namespace writerfilter::rtftok diff --git a/sw/source/writerfilter/ooxml/OOXMLDocumentImpl.cxx b/sw/source/writerfilter/ooxml/OOXMLDocumentImpl.cxx index cedaae79adb0..29f26feb7744 100644 --- a/sw/source/writerfilter/ooxml/OOXMLDocumentImpl.cxx +++ b/sw/source/writerfilter/ooxml/OOXMLDocumentImpl.cxx @@ -39,8 +39,8 @@ #include #include #include +#include #include -#include #include #include @@ -64,7 +64,7 @@ OOXMLDocumentImpl::OOXMLDocumentImpl(OOXMLStream::Pointer_t pStream, uno::Refere , mnProgressLastPos(0) , mnProgressCurrentPos(0) , mnProgressEndPos(0) - , m_rBaseURL(utl::MediaDescriptor(rDescriptor).getUnpackedValueOrDefault(u"DocumentBaseURL"_ustr, OUString())) + , m_rBaseURL(comphelper::SequenceAsHashMap(rDescriptor).getUnpackedValueOrDefault(u"DocumentBaseURL"_ustr, OUString())) , maMediaDescriptor(rDescriptor) , mxGraphicMapper(graphic::GraphicMapper::create(mpStream->getContext())) { @@ -438,7 +438,7 @@ void OOXMLDocumentImpl::resolve(Stream & rStream) { StatusIndicatorGuard aStatusIndicatorGuard(mxStatusIndicator); - if (utl::MediaDescriptor(maMediaDescriptor).getUnpackedValueOrDefault(u"ReadGlossaries"_ustr, false)) + if (comphelper::SequenceAsHashMap(maMediaDescriptor).getUnpackedValueOrDefault(u"ReadGlossaries"_ustr, false)) { resolveFastSubStream(rStream, OOXMLStream::StreamType_t::GLOSSARY); return; diff --git a/sw/source/writerfilter/rtftok/rtfdocumentfactory.cxx b/sw/source/writerfilter/rtftok/rtfdocumentfactory.cxx index 1ff344fa12b6..8048f977a397 100644 --- a/sw/source/writerfilter/rtftok/rtfdocumentfactory.cxx +++ b/sw/source/writerfilter/rtftok/rtfdocumentfactory.cxx @@ -9,6 +9,8 @@ #include "rtfdocumentimpl.hxx" +#include + namespace writerfilter::rtftok { RTFDocument::Pointer_t RTFDocumentFactory::createDocument( @@ -17,7 +19,7 @@ RTFDocument::Pointer_t RTFDocumentFactory::createDocument( rtl::Reference const& xDstDoc, css::uno::Reference const& xFrame, css::uno::Reference const& xStatusIndicator, - const utl::MediaDescriptor& rMediaDescriptor) + const comphelper::SequenceAsHashMap& rMediaDescriptor) { return new RTFDocumentImpl(xContext, xInputStream, xDstDoc, xFrame, xStatusIndicator, rMediaDescriptor); diff --git a/sw/source/writerfilter/rtftok/rtfdocumentimpl.cxx b/sw/source/writerfilter/rtftok/rtfdocumentimpl.cxx index 8ef64f97eea3..14c9f16a4225 100644 --- a/sw/source/writerfilter/rtftok/rtfdocumentimpl.cxx +++ b/sw/source/writerfilter/rtftok/rtfdocumentimpl.cxx @@ -23,6 +23,7 @@ #include #include +#include #include #include #include @@ -299,7 +300,7 @@ RTFDocumentImpl::RTFDocumentImpl(uno::Reference const& x rtl::Reference const& xDstDoc, uno::Reference const& xFrame, uno::Reference const& xStatusIndicator, - const utl::MediaDescriptor& rMediaDescriptor) + const comphelper::SequenceAsHashMap& rMediaDescriptor) : m_xContext(xContext) , m_xInputStream(xInputStream) , m_xDstDoc(xDstDoc) diff --git a/sw/source/writerfilter/rtftok/rtfdocumentimpl.hxx b/sw/source/writerfilter/rtftok/rtfdocumentimpl.hxx index ad2069993504..7f21cc643d8a 100644 --- a/sw/source/writerfilter/rtftok/rtfdocumentimpl.hxx +++ b/sw/source/writerfilter/rtftok/rtfdocumentimpl.hxx @@ -696,7 +696,7 @@ public: rtl::Reference const& xDstDoc, css::uno::Reference const& xFrame, css::uno::Reference const& xStatusIndicator, - const utl::MediaDescriptor& rMediaDescriptor); + const comphelper::SequenceAsHashMap& rMediaDescriptor); ~RTFDocumentImpl() override; // RTFDocument @@ -986,7 +986,7 @@ private: /// New document means not pasting into an existing one. bool m_bIsNewDoc; /// The media descriptor contains e.g. the base URL of the document. - const utl::MediaDescriptor& m_rMediaDescriptor; + const comphelper::SequenceAsHashMap& m_rMediaDescriptor; /// Flags for ensuring that only one header and footer is added per section bool m_hasRHeader; diff --git a/test/source/unoapi_test.cxx b/test/source/unoapi_test.cxx index e9c71a12c143..a6630169c40f 100644 --- a/test/source/unoapi_test.cxx +++ b/test/source/unoapi_test.cxx @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -152,7 +153,7 @@ uno::Any UnoApiTest::executeMacro(const OUString& rScriptURL, void UnoApiTest::save(TestFilter eFilter, const char* pPassword) { OUString aFilter(TestFilterNames.at(eFilter)); - utl::MediaDescriptor aMediaDescriptor; + comphelper::SequenceAsHashMap aMediaDescriptor; aMediaDescriptor[u"FilterName"_ustr] <<= aFilter; if (!maFilterOptions.isEmpty()) aMediaDescriptor[u"FilterOptions"_ustr] <<= maFilterOptions; diff --git a/unotools/source/misc/mediadescriptor.cxx b/unotools/source/misc/mediadescriptor.cxx index f1f192149086..2a44bf8f699e 100644 --- a/unotools/source/misc/mediadescriptor.cxx +++ b/unotools/source/misc/mediadescriptor.cxx @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -45,7 +46,7 @@ #include #include -namespace utl { +namespace utl::MediaDescriptor { namespace { @@ -63,38 +64,364 @@ OUString removeFragment(OUString const & uri) { } } -} +/** @short tries to open a stream by using the given URL. -MediaDescriptor::MediaDescriptor() + @descr First it tries to open the content in r/w mode (if its + allowed to do so). Only in case it's not allowed or it failed + the stream will be tried to open in readonly mode. + + The MediaDescriptor itself is changed inside this method. + Means: the stream is added internal and not returned by a value. + + @param sURL + the URL for open. + + @param bLockFile + specifies whether the file should be locked + + @return TRUE if the stream could be added successfully. + Note: If FALSE is returned, the error was already handled inside! + + @throw [css::uno::RuntimeException] + if the MediaDescriptor seems to be invalid! + */ +bool impl_openStreamWithURL(comphelper::SequenceAsHashMap& rMediaDescriptor, const OUString& sURL, + bool bLockFile) { + if (sURL.matchIgnoreAsciiCase(".component:") || sURL.matchIgnoreAsciiCase("private:factory/")) + return false; // No UCB content for .component URLs and factory URLs + + if (INetURLObject(sURL).IsExoticProtocol()) + return false; + + OUString referer(rMediaDescriptor.getUnpackedValueOrDefault(PROP_REFERRER, OUString())); + if (SvtSecurityOptions::isUntrustedReferer(referer)) + { + return false; + } + + // prepare the environment + auto xOrgInteraction = rMediaDescriptor.getUnpackedValueOrDefault( + PROP_INTERACTIONHANDLER, css::uno::Reference()); + + auto xAuthenticationInteraction = rMediaDescriptor.getUnpackedValueOrDefault( + PROP_AUTHENTICATIONHANDLER, css::uno::Reference()); + + rtl::Reference xInteraction + = new comphelper::StillReadWriteInteraction(xOrgInteraction, xAuthenticationInteraction); + + css::uno::Reference xProgress; + rtl::Reference xCommandEnv + = new ucbhelper::CommandEnvironment(xInteraction, xProgress); + + // try to create the content + // no content -> no stream => return immediately with FALSE + ucbhelper::Content aContent; + css::uno::Reference xContent; + try + { + aContent = ucbhelper::Content(sURL, xCommandEnv, comphelper::getProcessComponentContext()); + xContent = aContent.get(); + } + catch (const css::uno::RuntimeException&) + { + throw; + } + catch (const css::ucb::ContentCreationException&) + { + TOOLS_WARN_EXCEPTION("unotools.misc", "url: '" << sURL << "'"); + return false; // TODO error handling + } + catch (const css::uno::Exception&) + { + TOOLS_WARN_EXCEPTION("unotools.misc", "url: '" << sURL << "'"); + return false; // TODO error handling + } + + // try to open the file in read/write mode + // (if it's allowed to do so). + // But handle errors in a "hidden mode". Because + // we try it readonly later - if read/write is not an option. + css::uno::Reference xStream; + css::uno::Reference xInputStream; + + bool bReadOnly = false; + bool bModeRequestedExplicitly = false; + auto pIt = rMediaDescriptor.find(PROP_READONLY); + if (pIt != rMediaDescriptor.end()) + { + pIt->second >>= bReadOnly; + bModeRequestedExplicitly = true; + } + + if (!bReadOnly && bLockFile) + { + try + { + // TODO: use "special" still interaction to suppress error messages + xStream = aContent.openWriteableStream(); + if (xStream.is()) + xInputStream = xStream->getInputStream(); + } + catch (const css::uno::RuntimeException&) + { + throw; + } + catch (const css::uno::Exception&) + { + css::uno::Any ex(cppu::getCaughtException()); + // ignore exception, if reason was problem reasoned on + // open it in WRITABLE mode! Then we try it READONLY + // later a second time. + // All other errors must be handled as real error an + // break this method. + if (!xInteraction->wasWriteError() || bModeRequestedExplicitly) + { + SAL_WARN("unotools.misc", "url: '" << sURL << "' " << exceptionToString(ex)); + // If the protocol is webdav, then we need to treat the stream as readonly, even if the + // operation was requested as read/write explicitly (the WebDAV UCB implementation is monodirectional + // read or write not both at the same time). + if (!INetURLObject(sURL).isAnyKnownWebDAVScheme()) + return false; + } + xStream.clear(); + xInputStream.clear(); + } + } + + // If opening of the stream in read/write mode was not allowed + // or failed by an error - we must try it in readonly mode. + if (!xInputStream.is()) + { + OUString aScheme; + + try + { + css::uno::Reference xContId( + aContent.get().is() ? aContent.get()->getIdentifier() : nullptr); + + if (xContId.is()) + aScheme = xContId->getContentProviderScheme(); + + // Only file system content provider is able to provide XStream + // so for this content impossibility to create XStream triggers + // switch to readonly mode in case of opening with locking on + if (bLockFile && aScheme.equalsIgnoreAsciiCase("file")) + bReadOnly = true; + else + { + bool bRequestReadOnly = bReadOnly; + aContent.getPropertyValue(u"IsReadOnly"_ustr) >>= bReadOnly; + if (bReadOnly && !bRequestReadOnly && bModeRequestedExplicitly) + return false; // the document is explicitly requested with WRITABLE mode + } + } + catch (const css::uno::RuntimeException&) + { + throw; + } + catch (const css::uno::Exception&) + { /* no error handling if IsReadOnly property does not exist for UCP */ + } + + if (bReadOnly) + rMediaDescriptor[PROP_READONLY] <<= bReadOnly; + + xInteraction->resetInterceptions(); + xInteraction->resetErrorStates(); + try + { + // all the contents except file-URLs should be opened as usual + if (bLockFile || !aScheme.equalsIgnoreAsciiCase("file")) + xInputStream = aContent.openStream(); + else + xInputStream = aContent.openStreamNoLock(); + } + catch (const css::uno::RuntimeException&) + { + throw; + } + catch (const css::uno::Exception&) + { + TOOLS_INFO_EXCEPTION("unotools.misc", "url: '" << sURL << "'"); + return false; + } + } + + // add streams to the descriptor + if (xContent.is()) + rMediaDescriptor[PROP_UCBCONTENT] <<= xContent; + if (xStream.is()) + rMediaDescriptor[PROP_STREAM] <<= xStream; + if (xInputStream.is()) + rMediaDescriptor[PROP_INPUTSTREAM] <<= xInputStream; + + // At least we need an input stream. The r/w stream is optional ... + return xInputStream.is(); } -MediaDescriptor::MediaDescriptor(const css::uno::Sequence< css::beans::PropertyValue >& lSource) - : SequenceAsHashMap(lSource) +/** @short tries to open a stream by using the given PostData stream. + + @descr The stream is used directly ... + + The MediaDescriptor itself is changed inside this method. + Means: the stream is added internal and not returned by a value. + + @param _rxPostData + the PostData stream. + + @return TRUE if the stream could be added successfully. + Note: If FALSE is returned, the error was already handled inside! + + @throw [css::uno::RuntimeException] + if the MediaDescriptor seems to be invalid! + + @throw [css::lang::IllegalArgumentException] + if the given PostData stream is . + */ +bool impl_openStreamWithPostData(comphelper::SequenceAsHashMap& rMediaDescriptor, + const css::uno::Reference& _rxPostData) { + if (!_rxPostData.is()) + throw css::lang::IllegalArgumentException(u"Found invalid PostData."_ustr, + css::uno::Reference(), 1); + + // PostData can't be used in read/write mode! + rMediaDescriptor[PROP_READONLY] <<= true; + + // prepare the environment + auto xInteraction = rMediaDescriptor.getUnpackedValueOrDefault( + PROP_INTERACTIONHANDLER, css::uno::Reference()); + css::uno::Reference xProgress; + rtl::Reference<::ucbhelper::CommandEnvironment> xCommandEnv + = new ::ucbhelper::CommandEnvironment(xInteraction, xProgress); + + // media type + OUString sMediaType = rMediaDescriptor.getUnpackedValueOrDefault(PROP_MEDIATYPE, OUString()); + if (sMediaType.isEmpty()) + { + sMediaType = "application/x-www-form-urlencoded"; + rMediaDescriptor[PROP_MEDIATYPE] <<= sMediaType; + } + + // url + OUString sURL(rMediaDescriptor.getUnpackedValueOrDefault(PROP_URL, OUString())); + + css::uno::Reference xResultStream; + try + { + // seek PostData stream to the beginning + css::uno::Reference xSeek(_rxPostData, css::uno::UNO_QUERY); + if (xSeek.is()) + xSeek->seek(0); + + // a content for the URL + ::ucbhelper::Content aContent(sURL, xCommandEnv, comphelper::getProcessComponentContext()); + + // use post command + css::ucb::PostCommandArgument2 aPostArgument; + aPostArgument.Source = _rxPostData; + css::uno::Reference xSink(new ucbhelper::ActiveDataSink); + aPostArgument.Sink = xSink; + aPostArgument.MediaType = sMediaType; + aPostArgument.Referer + = rMediaDescriptor.getUnpackedValueOrDefault(PROP_REFERRER, OUString()); + + aContent.executeCommand(u"post"_ustr, css::uno::Any(aPostArgument)); + + // get result + xResultStream = xSink->getInputStream(); + } + catch (const css::uno::Exception&) + { + } + + // success? + if (!xResultStream.is()) + { + OSL_FAIL("no valid reply to the HTTP-Post"); + return false; + } + + rMediaDescriptor[PROP_INPUTSTREAM] <<= xResultStream; + return true; } -bool MediaDescriptor::isStreamReadOnly() const +/** @short it checks if the descriptor already has a valid + InputStream item and creates a new one, if not. + + @descr This function uses the current items of this MediaDescriptor, + to open the stream (as e.g. URL, ReadOnly, PostData etcpp.). + It creates a seekable stream and put it into the descriptor. + + A might existing InteractionHandler will be used automatically, + to solve problems! + + @param bLockFile + specifies whether the file should be locked + + @return TRUE, if the stream was already part of the descriptor or could + be created as new item. FALSE otherwise. + */ +bool impl_addInputStream(comphelper::SequenceAsHashMap& rMediaDescriptor, bool bLockFile) +{ + // check for an already existing stream item first + auto pIt = rMediaDescriptor.find(PROP_INPUTSTREAM); + if (pIt != rMediaDescriptor.end()) + return true; + + try + { + // No stream available - create a new one + // a) data comes as PostData ... + pIt = rMediaDescriptor.find(PROP_POSTDATA); + if (pIt != rMediaDescriptor.end()) + { + const css::uno::Any& rPostData = pIt->second; + css::uno::Reference xPostData; + rPostData >>= xPostData; + + return impl_openStreamWithPostData(rMediaDescriptor, xPostData); + } + + // b) ... or we must get it from the given URL + OUString sURL = rMediaDescriptor.getUnpackedValueOrDefault(PROP_URL, OUString()); + if (sURL.isEmpty()) + throw css::uno::Exception(u"Found no URL."_ustr, + css::uno::Reference()); + + return impl_openStreamWithURL(rMediaDescriptor, removeFragment(sURL), bLockFile); + } + catch (const css::uno::Exception&) + { + TOOLS_WARN_EXCEPTION("unotools.misc", "invalid MediaDescriptor detected"); + return false; + } +} + +} + +bool isStreamReadOnly(const comphelper::SequenceAsHashMap& rMediaDescriptor) { bool bReadOnly = false; // check for explicit readonly state - const_iterator pIt = find(MediaDescriptor::PROP_READONLY); - if (pIt != end()) + auto pIt = rMediaDescriptor.find(PROP_READONLY); + if (pIt != rMediaDescriptor.end()) { pIt->second >>= bReadOnly; return bReadOnly; } // streams based on post data are readonly by definition - pIt = find(MediaDescriptor::PROP_POSTDATA); - if (pIt != end()) + pIt = rMediaDescriptor.find(PROP_POSTDATA); + if (pIt != rMediaDescriptor.end()) return true; // A XStream capsulate XInputStream and XOutputStream ... // If it exists - the file must be open in read/write mode! - pIt = find(MediaDescriptor::PROP_STREAM); - if (pIt != end()) + pIt = rMediaDescriptor.find(PROP_STREAM); + if (pIt != rMediaDescriptor.end()) return false; // Only file system content provider is able to provide XStream @@ -102,7 +429,7 @@ bool MediaDescriptor::isStreamReadOnly() const // switch to readonly mode. try { - css::uno::Reference< css::ucb::XContent > xContent = getUnpackedValueOrDefault(MediaDescriptor::PROP_UCBCONTENT, css::uno::Reference< css::ucb::XContent >()); + auto xContent = rMediaDescriptor.getUnpackedValueOrDefault(PROP_UCBCONTENT, css::uno::Reference< css::ucb::XContent >()); if (xContent.is()) { css::uno::Reference< css::ucb::XContentIdentifier > xId = xContent->getIdentifier(); @@ -129,20 +456,22 @@ bool MediaDescriptor::isStreamReadOnly() const return bReadOnly; } -css::uno::Any MediaDescriptor::getComponentDataEntry( const OUString& rName ) const +css::uno::Any getComponentDataEntry(const comphelper::SequenceAsHashMap& rMediaDescriptor, + const OUString& rName) { - comphelper::SequenceAsHashMap::const_iterator aPropertyIter = find( PROP_COMPONENTDATA ); - if( aPropertyIter != end() ) + auto aPropertyIter = rMediaDescriptor.find(PROP_COMPONENTDATA); + if( aPropertyIter != rMediaDescriptor.end() ) return comphelper::NamedValueCollection( aPropertyIter->second ).get( rName ); return css::uno::Any(); } -void MediaDescriptor::setComponentDataEntry( const OUString& rName, const css::uno::Any& rValue ) +void setComponentDataEntry(comphelper::SequenceAsHashMap& rMediaDescriptor, + const OUString& rName, const css::uno::Any& rValue) { if( rValue.hasValue() ) { // get or create the 'ComponentData' property entry - css::uno::Any& rCompDataAny = operator[]( PROP_COMPONENTDATA ); + css::uno::Any& rCompDataAny = rMediaDescriptor[PROP_COMPONENTDATA]; // insert the value (retain sequence type, create NamedValue elements by default) bool bHasNamedValues = !rCompDataAny.hasValue() || rCompDataAny.has< css::uno::Sequence< css::beans::NamedValue > >(); bool bHasPropValues = rCompDataAny.has< css::uno::Sequence< css::beans::PropertyValue > >(); @@ -159,14 +488,15 @@ void MediaDescriptor::setComponentDataEntry( const OUString& rName, const css::u else { // if an empty Any is passed, clear the entry - clearComponentDataEntry( rName ); + clearComponentDataEntry(rMediaDescriptor, rName); } } -void MediaDescriptor::clearComponentDataEntry( const OUString& rName ) +void clearComponentDataEntry(comphelper::SequenceAsHashMap& rMediaDescriptor, + const OUString& rName) { - comphelper::SequenceAsHashMap::iterator aPropertyIter = find( PROP_COMPONENTDATA ); - if( aPropertyIter == end() ) + auto aPropertyIter = rMediaDescriptor.find(PROP_COMPONENTDATA); + if( aPropertyIter == rMediaDescriptor.end() ) return; css::uno::Any& rCompDataAny = aPropertyIter->second; @@ -180,325 +510,55 @@ void MediaDescriptor::clearComponentDataEntry( const OUString& rName ) aCompDataMap.erase( rName ); // write back the sequence, or remove it completely if it is empty if( aCompDataMap.empty() ) - erase( aPropertyIter ); + rMediaDescriptor.erase(aPropertyIter); else rCompDataAny = aCompDataMap.getAsConstAny( bHasPropValues ); } } -css::uno::Sequence< css::beans::NamedValue > MediaDescriptor::requestAndVerifyDocPassword( +css::uno::Sequence< css::beans::NamedValue > requestAndVerifyDocPassword( + comphelper::SequenceAsHashMap& rMediaDescriptor, comphelper::IDocPasswordVerifier& rVerifier, comphelper::DocPasswordRequestType eRequestType, const ::std::vector< OUString >* pDefaultPasswords ) { - css::uno::Sequence< css::beans::NamedValue > aMediaEncData = getUnpackedValueOrDefault( + auto aMediaEncData = rMediaDescriptor.getUnpackedValueOrDefault( PROP_ENCRYPTIONDATA, css::uno::Sequence< css::beans::NamedValue >() ); - OUString aMediaPassword = getUnpackedValueOrDefault( + OUString aMediaPassword = rMediaDescriptor.getUnpackedValueOrDefault( PROP_PASSWORD, OUString() ); - css::uno::Reference< css::task::XInteractionHandler > xInteractHandler = getUnpackedValueOrDefault( + auto xInteractHandler = rMediaDescriptor.getUnpackedValueOrDefault( PROP_INTERACTIONHANDLER, css::uno::Reference< css::task::XInteractionHandler >() ); - OUString aDocumentName = getUnpackedValueOrDefault( + OUString aDocumentName = rMediaDescriptor.getUnpackedValueOrDefault( PROP_URL, OUString() ); bool bIsDefaultPassword = false; css::uno::Sequence< css::beans::NamedValue > aEncryptionData = comphelper::DocPasswordHelper::requestAndVerifyDocPassword( rVerifier, aMediaEncData, aMediaPassword, xInteractHandler, aDocumentName, eRequestType, pDefaultPasswords, &bIsDefaultPassword ); - erase( PROP_PASSWORD ); - erase( PROP_ENCRYPTIONDATA ); + rMediaDescriptor.erase(PROP_PASSWORD); + rMediaDescriptor.erase(PROP_ENCRYPTIONDATA); // insert encryption info into media descriptor // TODO if( aEncryptionData.hasElements() ) - (*this)[ PROP_ENCRYPTIONDATA ] <<= aEncryptionData; + rMediaDescriptor[PROP_ENCRYPTIONDATA] <<= aEncryptionData; return aEncryptionData; } -bool MediaDescriptor::addInputStream() +bool addInputStream(comphelper::SequenceAsHashMap& rMediaDescriptor) { - return impl_addInputStream( true ); + return impl_addInputStream(rMediaDescriptor, true); } /*-----------------------------------------------*/ -bool MediaDescriptor::addInputStreamOwnLock() +bool addInputStreamOwnLock(comphelper::SequenceAsHashMap& rMediaDescriptor) { const bool bLock = !comphelper::IsFuzzing() && officecfg::Office::Common::Misc::UseDocumentSystemFileLocking::get(); - return impl_addInputStream(bLock); + return impl_addInputStream(rMediaDescriptor, bLock); } -/*-----------------------------------------------*/ -bool MediaDescriptor::impl_addInputStream( bool bLockFile ) -{ - // check for an already existing stream item first - const_iterator pIt = find(MediaDescriptor::PROP_INPUTSTREAM); - if (pIt != end()) - return true; - - try - { - // No stream available - create a new one - // a) data comes as PostData ... - pIt = find(MediaDescriptor::PROP_POSTDATA); - if (pIt != end()) - { - const css::uno::Any& rPostData = pIt->second; - css::uno::Reference< css::io::XInputStream > xPostData; - rPostData >>= xPostData; - - return impl_openStreamWithPostData( xPostData ); - } - - // b) ... or we must get it from the given URL - OUString sURL = getUnpackedValueOrDefault(MediaDescriptor::PROP_URL, OUString()); - if (sURL.isEmpty()) - throw css::uno::Exception(u"Found no URL."_ustr, - css::uno::Reference< css::uno::XInterface >()); - - return impl_openStreamWithURL( removeFragment(sURL), bLockFile ); - } - catch(const css::uno::Exception&) - { - TOOLS_WARN_EXCEPTION("unotools.misc", "invalid MediaDescriptor detected"); - return false; - } -} - -bool MediaDescriptor::impl_openStreamWithPostData( const css::uno::Reference< css::io::XInputStream >& _rxPostData ) -{ - if ( !_rxPostData.is() ) - throw css::lang::IllegalArgumentException(u"Found invalid PostData."_ustr, - css::uno::Reference< css::uno::XInterface >(), 1); - - // PostData can't be used in read/write mode! - (*this)[MediaDescriptor::PROP_READONLY] <<= true; - - // prepare the environment - css::uno::Reference< css::task::XInteractionHandler > xInteraction = getUnpackedValueOrDefault( - MediaDescriptor::PROP_INTERACTIONHANDLER, - css::uno::Reference< css::task::XInteractionHandler >()); - css::uno::Reference< css::ucb::XProgressHandler > xProgress; - rtl::Reference<::ucbhelper::CommandEnvironment> xCommandEnv = new ::ucbhelper::CommandEnvironment(xInteraction, xProgress); - - // media type - OUString sMediaType = getUnpackedValueOrDefault(MediaDescriptor::PROP_MEDIATYPE, OUString()); - if (sMediaType.isEmpty()) - { - sMediaType = "application/x-www-form-urlencoded"; - (*this)[MediaDescriptor::PROP_MEDIATYPE] <<= sMediaType; - } - - // url - OUString sURL( getUnpackedValueOrDefault( PROP_URL, OUString() ) ); - - css::uno::Reference< css::io::XInputStream > xResultStream; - try - { - // seek PostData stream to the beginning - css::uno::Reference< css::io::XSeekable > xSeek( _rxPostData, css::uno::UNO_QUERY ); - if ( xSeek.is() ) - xSeek->seek( 0 ); - - // a content for the URL - ::ucbhelper::Content aContent( sURL, xCommandEnv, comphelper::getProcessComponentContext() ); - - // use post command - css::ucb::PostCommandArgument2 aPostArgument; - aPostArgument.Source = _rxPostData; - css::uno::Reference< css::io::XActiveDataSink > xSink( new ucbhelper::ActiveDataSink ); - aPostArgument.Sink = xSink; - aPostArgument.MediaType = sMediaType; - aPostArgument.Referer = getUnpackedValueOrDefault( PROP_REFERRER, OUString() ); - - aContent.executeCommand( u"post"_ustr, css::uno::Any( aPostArgument ) ); - - // get result - xResultStream = xSink->getInputStream(); - } - catch( const css::uno::Exception& ) - { - } - - // success? - if ( !xResultStream.is() ) - { - OSL_FAIL( "no valid reply to the HTTP-Post" ); - return false; - } - - (*this)[MediaDescriptor::PROP_INPUTSTREAM] <<= xResultStream; - return true; -} - -/*-----------------------------------------------*/ -bool MediaDescriptor::impl_openStreamWithURL( const OUString& sURL, bool bLockFile ) -{ - if (sURL.matchIgnoreAsciiCase(".component:") || sURL.matchIgnoreAsciiCase("private:factory/")) - return false; // No UCB content for .component URLs and factory URLs - - - if (INetURLObject(sURL).IsExoticProtocol()) - return false; - - OUString referer(getUnpackedValueOrDefault(PROP_REFERRER, OUString())); - if (SvtSecurityOptions::isUntrustedReferer(referer)) { - return false; - } - - // prepare the environment - css::uno::Reference< css::task::XInteractionHandler > xOrgInteraction = getUnpackedValueOrDefault( - MediaDescriptor::PROP_INTERACTIONHANDLER, - css::uno::Reference< css::task::XInteractionHandler >()); - - css::uno::Reference< css::task::XInteractionHandler > xAuthenticationInteraction = getUnpackedValueOrDefault( - MediaDescriptor::PROP_AUTHENTICATIONHANDLER, - css::uno::Reference< css::task::XInteractionHandler >()); - - rtl::Reference xInteraction = new comphelper::StillReadWriteInteraction(xOrgInteraction,xAuthenticationInteraction); - - css::uno::Reference< css::ucb::XProgressHandler > xProgress; - rtl::Reference<::ucbhelper::CommandEnvironment> xCommandEnv = new ::ucbhelper::CommandEnvironment(xInteraction, xProgress); - - // try to create the content - // no content -> no stream => return immediately with FALSE - ::ucbhelper::Content aContent; - css::uno::Reference< css::ucb::XContent > xContent; - try - { - aContent = ::ucbhelper::Content(sURL, xCommandEnv, comphelper::getProcessComponentContext()); - xContent = aContent.get(); - } - catch(const css::uno::RuntimeException&) - { throw; } - catch(const css::ucb::ContentCreationException&) - { - TOOLS_WARN_EXCEPTION("unotools.misc", "url: '" << sURL << "'"); - return false; // TODO error handling - } - catch(const css::uno::Exception&) - { - TOOLS_WARN_EXCEPTION("unotools.misc", "url: '" << sURL << "'"); - return false; // TODO error handling - } - - // try to open the file in read/write mode - // (if it's allowed to do so). - // But handle errors in a "hidden mode". Because - // we try it readonly later - if read/write is not an option. - css::uno::Reference< css::io::XStream > xStream; - css::uno::Reference< css::io::XInputStream > xInputStream; - - bool bReadOnly = false; - bool bModeRequestedExplicitly = false; - const_iterator pIt = find(MediaDescriptor::PROP_READONLY); - if (pIt != end()) - { - pIt->second >>= bReadOnly; - bModeRequestedExplicitly = true; - } - - if ( !bReadOnly && bLockFile ) - { - try - { - // TODO: use "special" still interaction to suppress error messages - xStream = aContent.openWriteableStream(); - if (xStream.is()) - xInputStream = xStream->getInputStream(); - } - catch(const css::uno::RuntimeException&) - { throw; } - catch(const css::uno::Exception&) - { - css::uno::Any ex( cppu::getCaughtException() ); - // ignore exception, if reason was problem reasoned on - // open it in WRITABLE mode! Then we try it READONLY - // later a second time. - // All other errors must be handled as real error an - // break this method. - if (!xInteraction->wasWriteError() || bModeRequestedExplicitly) - { - SAL_WARN("unotools.misc","url: '" << sURL << "' " << exceptionToString(ex)); - // If the protocol is webdav, then we need to treat the stream as readonly, even if the - // operation was requested as read/write explicitly (the WebDAV UCB implementation is monodirectional - // read or write not both at the same time). - if ( !INetURLObject( sURL ).isAnyKnownWebDAVScheme() ) - return false; - } - xStream.clear(); - xInputStream.clear(); - } - } - - // If opening of the stream in read/write mode was not allowed - // or failed by an error - we must try it in readonly mode. - if (!xInputStream.is()) - { - OUString aScheme; - - try - { - css::uno::Reference< css::ucb::XContentIdentifier > xContId( - aContent.get().is() ? aContent.get()->getIdentifier() : nullptr ); - - if ( xContId.is() ) - aScheme = xContId->getContentProviderScheme(); - - // Only file system content provider is able to provide XStream - // so for this content impossibility to create XStream triggers - // switch to readonly mode in case of opening with locking on - if( bLockFile && aScheme.equalsIgnoreAsciiCase("file") ) - bReadOnly = true; - else - { - bool bRequestReadOnly = bReadOnly; - aContent.getPropertyValue(u"IsReadOnly"_ustr) >>= bReadOnly; - if ( bReadOnly && !bRequestReadOnly && bModeRequestedExplicitly ) - return false; // the document is explicitly requested with WRITABLE mode - } - } - catch(const css::uno::RuntimeException&) - { throw; } - catch(const css::uno::Exception&) - { /* no error handling if IsReadOnly property does not exist for UCP */ } - - if ( bReadOnly ) - (*this)[MediaDescriptor::PROP_READONLY] <<= bReadOnly; - - xInteraction->resetInterceptions(); - xInteraction->resetErrorStates(); - try - { - // all the contents except file-URLs should be opened as usual - if ( bLockFile || !aScheme.equalsIgnoreAsciiCase("file") ) - xInputStream = aContent.openStream(); - else - xInputStream = aContent.openStreamNoLock(); - } - catch(const css::uno::RuntimeException&) - { - throw; - } - catch(const css::uno::Exception&) - { - TOOLS_INFO_EXCEPTION("unotools.misc","url: '" << sURL << "'"); - return false; - } - } - - // add streams to the descriptor - if (xContent.is()) - (*this)[MediaDescriptor::PROP_UCBCONTENT] <<= xContent; - if (xStream.is()) - (*this)[MediaDescriptor::PROP_STREAM] <<= xStream; - if (xInputStream.is()) - (*this)[MediaDescriptor::PROP_INPUTSTREAM] <<= xInputStream; - - // At least we need an input stream. The r/w stream is optional ... - return xInputStream.is(); -} - -} // namespace comphelper +} // namespace utl::MediaDescriptor /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/vbahelper/vbadocumentsbase.cxx b/vbahelper/source/vbahelper/vbadocumentsbase.cxx index ec7694c59294..7311224762c0 100644 --- a/vbahelper/source/vbahelper/vbadocumentsbase.cxx +++ b/vbahelper/source/vbahelper/vbadocumentsbase.cxx @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -256,9 +257,9 @@ uno::Any VbaDocumentsBase::createDocument() throw uno::RuntimeException( u"Not implemented"_ustr ); // prepare the media descriptor - utl::MediaDescriptor aMediaDesc; + comphelper::SequenceAsHashMap aMediaDesc; aMediaDesc[ utl::MediaDescriptor::PROP_MACROEXECUTIONMODE ] <<= document::MacroExecMode::USE_CONFIG; - aMediaDesc.setComponentDataEntry( u"ApplyFormDesignMode"_ustr , uno::Any( false ) ); + utl::MediaDescriptor::setComponentDataEntry(aMediaDesc, u"ApplyFormDesignMode"_ustr , uno::Any( false ) ); // create the new document uno::Reference< lang::XComponent > xComponent = xLoader->loadComponentFromURL( diff --git a/vcl/qa/cppunit/pdfexport/PDFEncryptionTest.cxx b/vcl/qa/cppunit/pdfexport/PDFEncryptionTest.cxx index fbdb3b7a21b1..ec261042165a 100644 --- a/vcl/qa/cppunit/pdfexport/PDFEncryptionTest.cxx +++ b/vcl/qa/cppunit/pdfexport/PDFEncryptionTest.cxx @@ -13,10 +13,10 @@ #include #include -#include #include #include #include +#include #include @@ -39,7 +39,7 @@ namespace class PDFEncryptionTest : public UnoApiTest { protected: - utl::MediaDescriptor maMediaDescriptor; + comphelper::SequenceAsHashMap maMediaDescriptor; public: PDFEncryptionTest() diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx b/vcl/qa/cppunit/pdfexport/pdfexport.cxx index 7766c3aa3e76..0da2c4f34305 100644 --- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx +++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx @@ -17,8 +17,8 @@ #include #include +#include #include -#include #include #include #include @@ -34,7 +34,7 @@ namespace class PdfExportTest : public UnoApiTest { protected: - utl::MediaDescriptor aMediaDescriptor; + comphelper::SequenceAsHashMap aMediaDescriptor; public: PdfExportTest() diff --git a/vcl/qa/cppunit/pdfexport/pdfexport2.cxx b/vcl/qa/cppunit/pdfexport/pdfexport2.cxx index b9c560f422b5..2b03fa88270b 100644 --- a/vcl/qa/cppunit/pdfexport/pdfexport2.cxx +++ b/vcl/qa/cppunit/pdfexport/pdfexport2.cxx @@ -26,8 +26,8 @@ #include #include +#include #include -#include #include #include #include @@ -56,7 +56,7 @@ namespace class PdfExportTest2 : public UnoApiTest { protected: - utl::MediaDescriptor aMediaDescriptor; + comphelper::SequenceAsHashMap aMediaDescriptor; public: PdfExportTest2() diff --git a/writerperfect/inc/ImportFilter.hxx b/writerperfect/inc/ImportFilter.hxx index b12f12be21f1..0483c06e03b6 100644 --- a/writerperfect/inc/ImportFilter.hxx +++ b/writerperfect/inc/ImportFilter.hxx @@ -20,6 +20,7 @@ #include #include +#include #include #include @@ -58,7 +59,7 @@ public: virtual sal_Bool SAL_CALL filter(const css::uno::Sequence& rDescriptor) override { - utl::MediaDescriptor aDescriptor(rDescriptor); + comphelper::SequenceAsHashMap aDescriptor(rDescriptor); css::uno::Reference xInputStream; aDescriptor[utl::MediaDescriptor::PROP_INPUTSTREAM] >>= xInputStream; if (!xInputStream.is()) @@ -158,7 +159,7 @@ public: private: virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) = 0; virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput, - Generator& rGenerator, utl::MediaDescriptor& rDescriptor) + Generator& rGenerator, comphelper::SequenceAsHashMap& rDescriptor) = 0; virtual void doRegisterHandlers(Generator&){}; diff --git a/writerperfect/qa/unit/DrawingImportTest.cxx b/writerperfect/qa/unit/DrawingImportTest.cxx index ea65c4d79179..ee4df8baab2b 100644 --- a/writerperfect/qa/unit/DrawingImportTest.cxx +++ b/writerperfect/qa/unit/DrawingImportTest.cxx @@ -46,13 +46,13 @@ private: virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override; virtual bool doImportDocument(weld::Window* pWindow, librevenge::RVNGInputStream& rInput, OdgGenerator& rGenerator, - utl::MediaDescriptor& rDescriptor) override; + comphelper::SequenceAsHashMap& rDescriptor) override; static void generate(librevenge::RVNGDrawingInterface& rDocument); }; bool DrawingImportFilter::doImportDocument(weld::Window*, librevenge::RVNGInputStream&, - OdgGenerator& rGenerator, utl::MediaDescriptor&) + OdgGenerator& rGenerator, comphelper::SequenceAsHashMap&) { DrawingImportFilter::generate(rGenerator); return true; diff --git a/writerperfect/qa/unit/EPUBExportTest.cxx b/writerperfect/qa/unit/EPUBExportTest.cxx index 25ef537a4e0a..4f502a1bf614 100644 --- a/writerperfect/qa/unit/EPUBExportTest.cxx +++ b/writerperfect/qa/unit/EPUBExportTest.cxx @@ -21,10 +21,10 @@ #include #include +#include #include #include #include -#include #include #include #include @@ -72,7 +72,7 @@ void EPUBExportTest::createDoc(std::u16string_view rFile, // Import the bugdoc and export as EPUB. loadFromFile(rFile); uno::Reference xStorable(mxComponent, uno::UNO_QUERY); - utl::MediaDescriptor aMediaDescriptor; + comphelper::SequenceAsHashMap aMediaDescriptor; aMediaDescriptor[u"FilterName"_ustr] <<= u"EPUB"_ustr; if (maFilterOptions.isEmpty()) aMediaDescriptor[u"FilterData"_ustr] <<= rFilterData; diff --git a/writerperfect/qa/unit/ImportTest.cxx b/writerperfect/qa/unit/ImportTest.cxx index c4fbf1eb57a8..9b6eaf9a5efc 100644 --- a/writerperfect/qa/unit/ImportTest.cxx +++ b/writerperfect/qa/unit/ImportTest.cxx @@ -21,6 +21,7 @@ #include #include +#include #include #include @@ -96,7 +97,7 @@ WpftLoader ImportTest::createCalcLoader(std::u16string_view rFile) const WpftLoader ImportTest::createLoader(const OUString& rUrl, const OUString& rFactoryUrl) const { - utl::MediaDescriptor aDesc; + comphelper::SequenceAsHashMap aDesc; aDesc[utl::MediaDescriptor::PROP_URL] <<= rUrl; aDesc[utl::MediaDescriptor::PROP_READONLY] <<= true; uno::Sequence lDesc(aDesc.getAsConstPropertyValueList()); diff --git a/writerperfect/qa/unit/PresentationImportTest.cxx b/writerperfect/qa/unit/PresentationImportTest.cxx index ed1d7a8bec5c..4aa4d74159a5 100644 --- a/writerperfect/qa/unit/PresentationImportTest.cxx +++ b/writerperfect/qa/unit/PresentationImportTest.cxx @@ -46,13 +46,14 @@ private: virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override; virtual bool doImportDocument(weld::Window* pWindow, librevenge::RVNGInputStream& rInput, OdpGenerator& rGenerator, - utl::MediaDescriptor& rDescriptor) override; + comphelper::SequenceAsHashMap& rDescriptor) override; static void generate(librevenge::RVNGPresentationInterface& rDocument); }; bool PresentationImportFilter::doImportDocument(weld::Window*, librevenge::RVNGInputStream&, - OdpGenerator& rGenerator, utl::MediaDescriptor&) + OdpGenerator& rGenerator, + comphelper::SequenceAsHashMap&) { PresentationImportFilter::generate(rGenerator); return true; diff --git a/writerperfect/qa/unit/SpreadsheetImportTest.cxx b/writerperfect/qa/unit/SpreadsheetImportTest.cxx index 1e3b21bc933b..42b0dce55507 100644 --- a/writerperfect/qa/unit/SpreadsheetImportTest.cxx +++ b/writerperfect/qa/unit/SpreadsheetImportTest.cxx @@ -44,13 +44,14 @@ private: virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override; virtual bool doImportDocument(weld::Window* pWindow, librevenge::RVNGInputStream& rInput, OdsGenerator& rGenerator, - utl::MediaDescriptor& rDescriptor) override; + comphelper::SequenceAsHashMap& rDescriptor) override; static void generate(librevenge::RVNGSpreadsheetInterface& rDocument); }; bool SpreadsheetImportFilter::doImportDocument(weld::Window*, librevenge::RVNGInputStream&, - OdsGenerator& rGenerator, utl::MediaDescriptor&) + OdsGenerator& rGenerator, + comphelper::SequenceAsHashMap&) { SpreadsheetImportFilter::generate(rGenerator); return true; diff --git a/writerperfect/qa/unit/TextImportTest.cxx b/writerperfect/qa/unit/TextImportTest.cxx index cef8cbe4f1f1..246b8314c507 100644 --- a/writerperfect/qa/unit/TextImportTest.cxx +++ b/writerperfect/qa/unit/TextImportTest.cxx @@ -44,13 +44,13 @@ private: virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override; virtual bool doImportDocument(weld::Window* pWindow, librevenge::RVNGInputStream& rInput, OdtGenerator& rGenerator, - utl::MediaDescriptor& rDescriptor) override; + comphelper::SequenceAsHashMap& rDescriptor) override; static void generate(librevenge::RVNGTextInterface& rDocument); }; bool TextImportFilter::doImportDocument(weld::Window*, librevenge::RVNGInputStream&, - OdtGenerator& rGenerator, utl::MediaDescriptor&) + OdtGenerator& rGenerator, comphelper::SequenceAsHashMap&) { TextImportFilter::generate(rGenerator); return true; diff --git a/writerperfect/source/calc/MSWorksCalcImportFilter.cxx b/writerperfect/source/calc/MSWorksCalcImportFilter.cxx index 314cb22af52a..e15bde010f50 100644 --- a/writerperfect/source/calc/MSWorksCalcImportFilter.cxx +++ b/writerperfect/source/calc/MSWorksCalcImportFilter.cxx @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -186,7 +187,7 @@ private: bool MSWorksCalcImportFilter::doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput, OdsGenerator& rGenerator, - utl::MediaDescriptor& mediaDescriptor) + comphelper::SequenceAsHashMap& mediaDescriptor) { libwps::WPSKind kind = libwps::WPS_TEXT; libwps::WPSCreator creator; @@ -343,7 +344,7 @@ MSWorksCalcImportFilter::filter(const css::uno::Sequence + +#include #include #include @@ -20,7 +23,7 @@ using libebook::EBOOKDocument; bool EBookImportFilter::doImportDocument(weld::Window*, librevenge::RVNGInputStream& rInput, OdtGenerator& rGenerator, - utl::MediaDescriptor& rDescriptor) + comphelper::SequenceAsHashMap& rDescriptor) { OUString aFilterName; diff --git a/writerperfect/source/writer/EBookImportFilter.hxx b/writerperfect/source/writer/EBookImportFilter.hxx index 13307321b029..68a34e091c69 100644 --- a/writerperfect/source/writer/EBookImportFilter.hxx +++ b/writerperfect/source/writer/EBookImportFilter.hxx @@ -34,7 +34,7 @@ private: virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override; virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput, OdtGenerator& rGenerator, - utl::MediaDescriptor& rDescriptor) override; + comphelper::SequenceAsHashMap& rDescriptor) override; }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerperfect/source/writer/EPUBExportFilter.cxx b/writerperfect/source/writer/EPUBExportFilter.cxx index c6571d978381..c025c67fb6ae 100644 --- a/writerperfect/source/writer/EPUBExportFilter.cxx +++ b/writerperfect/source/writer/EPUBExportFilter.cxx @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -83,7 +84,7 @@ sal_Bool EPUBExportFilter::filter(const uno::Sequence& rDe rProp.Value >>= nLayoutMethod; } - utl::MediaDescriptor aMediaDesc(rDescriptor); + comphelper::SequenceAsHashMap aMediaDesc(rDescriptor); mxStatusIndicator = aMediaDesc.getUnpackedValueOrDefault( utl::MediaDescriptor::PROP_STATUSINDICATOR, uno::Reference()); diff --git a/writerperfect/source/writer/EPUBPackage.cxx b/writerperfect/source/writer/EPUBPackage.cxx index beeca269e0df..36e9a47e45d0 100644 --- a/writerperfect/source/writer/EPUBPackage.cxx +++ b/writerperfect/source/writer/EPUBPackage.cxx @@ -19,6 +19,7 @@ #include #include +#include #include #include @@ -31,7 +32,7 @@ EPUBPackage::EPUBPackage(uno::Reference xContext, : mxContext(std::move(xContext)) { // Extract the output stream from the descriptor. - utl::MediaDescriptor aMediaDesc(rDescriptor); + comphelper::SequenceAsHashMap aMediaDesc(rDescriptor); auto xStream = aMediaDesc.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_STREAMFOROUTPUT, uno::Reference()); const sal_Int32 nOpenMode = embed::ElementModes::READWRITE | embed::ElementModes::TRUNCATE; diff --git a/writerperfect/source/writer/MSWorksImportFilter.cxx b/writerperfect/source/writer/MSWorksImportFilter.cxx index 5c0b2c6de33d..aca34d72c15f 100644 --- a/writerperfect/source/writer/MSWorksImportFilter.cxx +++ b/writerperfect/source/writer/MSWorksImportFilter.cxx @@ -11,6 +11,7 @@ #include #include +#include #include @@ -30,7 +31,7 @@ static bool handleEmbeddedWKSObject(const librevenge::RVNGBinaryData& data, bool MSWorksImportFilter::doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput, OdtGenerator& rGenerator, - utl::MediaDescriptor& mediaDescriptor) + comphelper::SequenceAsHashMap& mediaDescriptor) { libwps::WPSKind kind = libwps::WPS_TEXT; libwps::WPSCreator creator; diff --git a/writerperfect/source/writer/MSWorksImportFilter.hxx b/writerperfect/source/writer/MSWorksImportFilter.hxx index 629904fdaf8a..650b7089fc2a 100644 --- a/writerperfect/source/writer/MSWorksImportFilter.hxx +++ b/writerperfect/source/writer/MSWorksImportFilter.hxx @@ -34,7 +34,8 @@ public: private: virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override; virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput, - OdtGenerator& rGenerator, utl::MediaDescriptor&) override; + OdtGenerator& rGenerator, + comphelper::SequenceAsHashMap&) override; virtual void doRegisterHandlers(OdtGenerator& rGenerator) override; }; diff --git a/writerperfect/source/writer/MWAWImportFilter.cxx b/writerperfect/source/writer/MWAWImportFilter.cxx index da40cc530f20..32a0b76f4c19 100644 --- a/writerperfect/source/writer/MWAWImportFilter.cxx +++ b/writerperfect/source/writer/MWAWImportFilter.cxx @@ -35,7 +35,7 @@ static bool handleEmbeddedMWAWSpreadsheetObject(const librevenge::RVNGBinaryData } bool MWAWImportFilter::doImportDocument(weld::Window*, librevenge::RVNGInputStream& rInput, - OdtGenerator& rGenerator, utl::MediaDescriptor&) + OdtGenerator& rGenerator, comphelper::SequenceAsHashMap&) { return MWAWDocument::MWAW_R_OK == MWAWDocument::parse(&rInput, &rGenerator); } diff --git a/writerperfect/source/writer/MWAWImportFilter.hxx b/writerperfect/source/writer/MWAWImportFilter.hxx index b7bb19268919..186ac95f137c 100644 --- a/writerperfect/source/writer/MWAWImportFilter.hxx +++ b/writerperfect/source/writer/MWAWImportFilter.hxx @@ -34,7 +34,8 @@ public: private: virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override; virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput, - OdtGenerator& rGenerator, utl::MediaDescriptor&) override; + OdtGenerator& rGenerator, + comphelper::SequenceAsHashMap&) override; virtual void doRegisterHandlers(OdtGenerator& rGenerator) override; }; diff --git a/writerperfect/source/writer/PagesImportFilter.cxx b/writerperfect/source/writer/PagesImportFilter.cxx index 37fbd2d556cc..9a354e1cf83e 100644 --- a/writerperfect/source/writer/PagesImportFilter.cxx +++ b/writerperfect/source/writer/PagesImportFilter.cxx @@ -18,7 +18,7 @@ using libetonyek::EtonyekDocument; bool PagesImportFilter::doImportDocument(weld::Window*, librevenge::RVNGInputStream& rInput, - OdtGenerator& rGenerator, utl::MediaDescriptor&) + OdtGenerator& rGenerator, comphelper::SequenceAsHashMap&) { return EtonyekDocument::parse(&rInput, &rGenerator); } diff --git a/writerperfect/source/writer/PagesImportFilter.hxx b/writerperfect/source/writer/PagesImportFilter.hxx index 83fc04618df3..58c24f07c790 100644 --- a/writerperfect/source/writer/PagesImportFilter.hxx +++ b/writerperfect/source/writer/PagesImportFilter.hxx @@ -34,7 +34,7 @@ private: virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override; virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput, OdtGenerator& rGenerator, - utl::MediaDescriptor& rDescriptor) override; + comphelper::SequenceAsHashMap& rDescriptor) override; }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerperfect/source/writer/StarOfficeWriterImportFilter.cxx b/writerperfect/source/writer/StarOfficeWriterImportFilter.cxx index 6c9271c90941..39170ce57f86 100644 --- a/writerperfect/source/writer/StarOfficeWriterImportFilter.cxx +++ b/writerperfect/source/writer/StarOfficeWriterImportFilter.cxx @@ -41,7 +41,8 @@ static bool handleEmbeddedSTOFFWriterSpreadsheetObject(const librevenge::RVNGBin bool StarOfficeWriterImportFilter::doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput, - OdtGenerator& rGenerator, utl::MediaDescriptor&) + OdtGenerator& rGenerator, + comphelper::SequenceAsHashMap&) { STOFFDocument::Kind docKind = STOFFDocument::STOFF_K_UNKNOWN; const STOFFDocument::Confidence confidence diff --git a/writerperfect/source/writer/StarOfficeWriterImportFilter.hxx b/writerperfect/source/writer/StarOfficeWriterImportFilter.hxx index 8310f1cbf77b..531a4bc0ee54 100644 --- a/writerperfect/source/writer/StarOfficeWriterImportFilter.hxx +++ b/writerperfect/source/writer/StarOfficeWriterImportFilter.hxx @@ -35,7 +35,8 @@ public: private: virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override; virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput, - OdtGenerator& rGenerator, utl::MediaDescriptor&) override; + OdtGenerator& rGenerator, + comphelper::SequenceAsHashMap&) override; virtual void doRegisterHandlers(OdtGenerator& rGenerator) override; }; diff --git a/xmloff/source/chart/SchXMLChartContext.cxx b/xmloff/source/chart/SchXMLChartContext.cxx index 9258edca18f4..3bcc72941a33 100644 --- a/xmloff/source/chart/SchXMLChartContext.cxx +++ b/xmloff/source/chart/SchXMLChartContext.cxx @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #include #include @@ -693,10 +693,9 @@ static void lcl_ApplyDataFromRectangularRangeToDiagram( OUString aChartOleObjectName; if( xNewDoc.is() ) { - utl::MediaDescriptor aMediaDescriptor( xNewDoc->getArgs() ); + comphelper::SequenceAsHashMap aMediaDescriptor(xNewDoc->getArgs()); - utl::MediaDescriptor::const_iterator aIt( - aMediaDescriptor.find( u"HierarchicalDocumentName"_ustr)); + auto aIt(aMediaDescriptor.find(u"HierarchicalDocumentName"_ustr)); if( aIt != aMediaDescriptor.end() ) { aChartOleObjectName = (*aIt).second.get< OUString >(); diff --git a/xmlsecurity/source/helper/pdfsignaturehelper.cxx b/xmlsecurity/source/helper/pdfsignaturehelper.cxx index ebf5e83356a0..30e6c49a944d 100644 --- a/xmlsecurity/source/helper/pdfsignaturehelper.cxx +++ b/xmlsecurity/source/helper/pdfsignaturehelper.cxx @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include #include @@ -92,7 +92,7 @@ void GetSignatureLineShape(const uno::Reference& xModel, sal_Int3 } // Export just the signature line. - utl::MediaDescriptor aMediaDescriptor; + comphelper::SequenceAsHashMap aMediaDescriptor; aMediaDescriptor[u"FilterName"_ustr] <<= u"draw_pdf_Export"_ustr; SvMemoryStream aStream; uno::Reference xStream(new utl::OStreamWrapper(aStream));