summaryrefslogtreecommitdiff
path: root/basic/source
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2018-03-15 09:57:46 +0900
committerTomaž Vajngerl <quikee@gmail.com>2018-03-15 04:11:02 +0100
commitd775ef360168271f429466bbc174ae7dec402f1d (patch)
tree8e2772f7031c3af3fdd45afc0576faab81ccd8ce /basic/source
parent531036fa296b6bfca5ec93c4d7ef1264dc6e7b65 (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 'basic/source')
-rw-r--r--basic/source/uno/dlgcont.cxx21
1 files changed, 13 insertions, 8 deletions
diff --git a/basic/source/uno/dlgcont.cxx b/basic/source/uno/dlgcont.cxx
index ac347db045de..24ecf29d4d22 100644
--- a/basic/source/uno/dlgcont.cxx
+++ b/basic/source/uno/dlgcont.cxx
@@ -31,6 +31,7 @@
#include <com/sun/star/resource/StringResourceWithStorage.hpp>
#include <com/sun/star/resource/StringResourceWithLocation.hpp>
#include <com/sun/star/document/GraphicObjectResolver.hpp>
+#include <com/sun/star/document/XGraphicStorageHandler.hpp>
#include <dlgcont.hxx>
#include <comphelper/fileformat.h>
#include <comphelper/processfactory.hxx>
@@ -236,17 +237,21 @@ void SfxDialogLibraryContainer::storeLibrariesToStorage( const uno::Reference< e
mxContext->getServiceManager()->createInstanceWithContext("com.sun.star.awt.UnoControlDialogModel", mxContext),
UNO_QUERY );
::xmlscript::importDialogModel( xInput, xDialogModel, mxContext, mxOwnerDocument );
- std::vector< OUString > vEmbeddedImageURLs;
- GraphicObject::InspectForGraphicObjectImageURL( Reference<XInterface>(xDialogModel, UNO_QUERY), vEmbeddedImageURLs );
- if ( !vEmbeddedImageURLs.empty() )
+ std::vector<uno::Reference<graphic::XGraphic>> vxGraphicList;
+ vcl::graphic::SearchForGraphics(Reference<XInterface>(xDialogModel, UNO_QUERY), vxGraphicList);
+ if (!vxGraphicList.empty())
{
// Export the images to the storage
- Reference< document::XGraphicObjectResolver > xGraphicResolver =
- document::GraphicObjectResolver::createWithStorage( mxContext, xStorage );
- if ( xGraphicResolver.is() )
+ Reference<document::XGraphicObjectResolver> xGraphicResolver;
+ xGraphicResolver.set(document::GraphicObjectResolver::createWithStorage(mxContext, xStorage));
+ Reference<document::XGraphicStorageHandler> xGraphicStorageHandler;
+ xGraphicStorageHandler.set(xGraphicResolver, uno::UNO_QUERY);
+ if (xGraphicStorageHandler.is())
{
- for ( const OUString& rURL : vEmbeddedImageURLs )
- xGraphicResolver->resolveGraphicObjectURL( rURL );
+ for (uno::Reference<graphic::XGraphic> const & rxGraphic : vxGraphicList)
+ {
+ xGraphicStorageHandler->saveGraphic(rxGraphic);
+ }
}
}
}