diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2018-03-15 09:57:46 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2018-03-15 04:11:02 +0100 |
commit | d775ef360168271f429466bbc174ae7dec402f1d (patch) | |
tree | 8e2772f7031c3af3fdd45afc0576faab81ccd8ce /dbaccess | |
parent | 531036fa296b6bfca5ec93c4d7ef1264dc6e7b65 (diff) |
change recursive ImageURL prop. search to use XGraphic
In two cases we need to traverse and gather all ImageURL properties
and get the URL string and store the graphic content to a storage
(like we do in xmloff filter). ImageURL property can now only store
external URL and Graphic stores the embedded XGraphic, so this was
changed to look into Graphic property first and then ImageURL.
We also don't gather URL sting anymore so they need to be loaded
to XGraphic when gathering them.
Change-Id: I5f3f4be2b403b9589d72b8733df0c97109f2b65d
Reviewed-on: https://gerrit.libreoffice.org/51308
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/source/core/dataaccess/databasedocument.cxx | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx index b8c15f49df88..27a2114ae9fb 100644 --- a/dbaccess/source/core/dataaccess/databasedocument.cxx +++ b/dbaccess/source/core/dataaccess/databasedocument.cxx @@ -61,6 +61,7 @@ #include <com/sun/star/awt/XControl.hpp> #include <com/sun/star/awt/DialogProvider.hpp> #include <com/sun/star/document/XGraphicObjectResolver.hpp> +#include <com/sun/star/document/XGraphicStorageHandler.hpp> #include <comphelper/documentconstants.hxx> #include <comphelper/enumhelper.hxx> @@ -355,7 +356,7 @@ void lcl_uglyHackToStoreDialogeEmbedImages( const Reference< XStorageBasedLibrar Sequence< OUString > sLibraries = xDlgCont->getElementNames(); Reference< XStorage > xTmpPic = xStorage->openStorageElement( "tempPictures", ElementModes::READWRITE ); - std::vector< OUString > vEmbedImgUrls; + std::vector<uno::Reference<graphic::XGraphic>> vxGraphicList; for ( sal_Int32 i=0; i < sLibraries.getLength(); ++i ) { OUString sLibrary( sLibraries[ i ] ); @@ -374,21 +375,25 @@ void lcl_uglyHackToStoreDialogeEmbedImages( const Reference< XStorageBasedLibrar Reference< css::awt::XControl > xDialog( xDlgPrv->createDialog( sDialogUrl ), UNO_QUERY ); Reference< XInterface > xModel( xDialog->getModel() ); - GraphicObject::InspectForGraphicObjectImageURL( xModel, vEmbedImgUrls ); + vcl::graphic::SearchForGraphics(xModel, vxGraphicList); } } } // if we have any image urls, make sure we copy the associated images into tempPictures - if ( !vEmbedImgUrls.empty() ) + if (!vxGraphicList.empty()) { // Export the images to the storage - Reference< XGraphicObjectResolver > xGraphicResolver = GraphicObjectResolver::createWithStorage(rxContext, xTmpPic); - if ( xGraphicResolver.is() ) + uno::Reference<document::XGraphicObjectResolver> xGraphicResolver; + xGraphicResolver.set(GraphicObjectResolver::createWithStorage(rxContext, xTmpPic)); + uno::Reference<document::XGraphicStorageHandler> xGraphicStorageHandler; + xGraphicStorageHandler.set(xGraphicResolver, uno::UNO_QUERY); + if (xGraphicStorageHandler.is()) { - for ( const OUString& rURL : vEmbedImgUrls ) - xGraphicResolver->resolveGraphicObjectURL( rURL ); + for (uno::Reference<graphic::XGraphic> const & rxGraphic : vxGraphicList) + { + xGraphicStorageHandler->saveGraphic(rxGraphic); + } } - // delete old 'Pictures' storage and copy the contents of tempPictures into xStorage xStorage->removeElement( sPictures ); xTmpPic->copyElementTo( sPictures, xStorage, sPictures ); |