diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2018-01-04 15:13:59 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2018-01-07 03:24:19 +0100 |
commit | 0189792bd8837057e853a48499b4d59f9149490f (patch) | |
tree | c983c4808eab1c3cbc58e4a415e158d36dd5a44b /svtools | |
parent | 7cd7bb90b2f07d104b1cd7680b56da2fe58d4564 (diff) |
SAL_WARN when using the interal GraphicObject URL
Write a warn if a URL is created from a internal GraphicObject
URL as this is now deprecated.
Extract the way to determine if a URL is internal to its own
function, so it can be used to check and rewrite places that use
it.
Change-Id: Iedf13a596eab839094ea98e41787865bf6783adf
Reviewed-on: https://gerrit.libreoffice.org/47495
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Tested-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/source/graphic/grfmgr.cxx | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/svtools/source/graphic/grfmgr.cxx b/svtools/source/graphic/grfmgr.cxx index 5d20b4128c6a..210206d52553 100644 --- a/svtools/source/graphic/grfmgr.cxx +++ b/svtools/source/graphic/grfmgr.cxx @@ -1039,11 +1039,18 @@ IMPL_LINK_NOARG(GraphicObject, ImplAutoSwapOutHdl, Timer *, void) #define UNO_NAME_GRAPHOBJ_URLPREFIX "vnd.sun.star.GraphicObject:" -GraphicObject GraphicObject::CreateGraphicObjectFromURL( const OUString &rURL ) +bool GraphicObject::isGraphicObjectUniqueIdURL(OUString const & rURL) { - const OUString aPrefix( UNO_NAME_GRAPHOBJ_URLPREFIX ); - if( rURL.startsWith( aPrefix ) ) + const OUString aPrefix(UNO_NAME_GRAPHOBJ_URLPREFIX); + return rURL.startsWith(aPrefix); +} + +GraphicObject GraphicObject::CreateGraphicObjectFromURL(OUString const & rURL) +{ + if (GraphicObject::isGraphicObjectUniqueIdURL(rURL)) { + SAL_WARN("vcl", "Deprecated URL '" << rURL << "' was used to create a GraphicObject"); + // graphic manager url OString aUniqueID(OUStringToOString(rURL.copy(sizeof(UNO_NAME_GRAPHOBJ_URLPREFIX) - 1), RTL_TEXTENCODING_UTF8)); return GraphicObject( aUniqueID ); |