Kaydet (Commit) 0189792b authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl Kaydeden (comit) Tomaž Vajngerl

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/47495Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarTomaž Vajngerl <quikee@gmail.com>
Tested-by: 's avatarTomaž Vajngerl <quikee@gmail.com>
üst 7cd7bb90
...@@ -465,7 +465,9 @@ public: ...@@ -465,7 +465,9 @@ public:
void StopAnimation( OutputDevice* pOut = nullptr, long nExtraData = 0 ); void StopAnimation( OutputDevice* pOut = nullptr, long nExtraData = 0 );
static GraphicObject CreateGraphicObjectFromURL( const OUString &rURL ); static bool isGraphicObjectUniqueIdURL(OUString const & rURL);
static GraphicObject CreateGraphicObjectFromURL(OUString const & rURL);
// will inspect an object ( e.g. a control ) for any 'ImageURL' // will inspect an object ( e.g. a control ) for any 'ImageURL'
// properties and return these in a vector. Note: this implementation // properties and return these in a vector. Note: this implementation
// will cater for XNameContainer objects and deep inspect any containers // will cater for XNameContainer objects and deep inspect any containers
......
...@@ -1039,11 +1039,18 @@ IMPL_LINK_NOARG(GraphicObject, ImplAutoSwapOutHdl, Timer *, void) ...@@ -1039,11 +1039,18 @@ IMPL_LINK_NOARG(GraphicObject, ImplAutoSwapOutHdl, Timer *, void)
#define UNO_NAME_GRAPHOBJ_URLPREFIX "vnd.sun.star.GraphicObject:" #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 ); const OUString aPrefix(UNO_NAME_GRAPHOBJ_URLPREFIX);
if( rURL.startsWith( aPrefix ) ) 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 // graphic manager url
OString aUniqueID(OUStringToOString(rURL.copy(sizeof(UNO_NAME_GRAPHOBJ_URLPREFIX) - 1), RTL_TEXTENCODING_UTF8)); OString aUniqueID(OUStringToOString(rURL.copy(sizeof(UNO_NAME_GRAPHOBJ_URLPREFIX) - 1), RTL_TEXTENCODING_UTF8));
return GraphicObject( aUniqueID ); return GraphicObject( aUniqueID );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment