extensions/source/propctrlr/formcomponenthandler.cxx |   11 +++--------
 extensions/source/propctrlr/formstrings.hxx          |    1 +
 2 files changed, 4 insertions(+), 8 deletions(-)

New commits:
commit 4671c863815826c1fbbb4343b53f9d74803aaa7d
Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
Date:   Sat Apr 21 14:10:23 2018 +0900

    Get rid of GraphicObject URL in extensions - PropertyController
    
    Instead of that, use "Graphic" property and set an XGraphic.
    
    Change-Id: Ib3084d22b422b82b69be3d410560caac303e780d
    Reviewed-on: https://gerrit.libreoffice.org/53240
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>

diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx 
b/extensions/source/propctrlr/formcomponenthandler.cxx
index 9d8a6f43292b..06e7cb3d6398 100644
--- a/extensions/source/propctrlr/formcomponenthandler.cxx
+++ b/extensions/source/propctrlr/formcomponenthandler.cxx
@@ -103,8 +103,6 @@
 #include <limits>
 #include <memory>
 
-#define GRAPHOBJ_URLPREFIX "vnd.sun.star.GraphicObject:"
-
 extern "C" void createRegistryInfo_FormComponentPropertyHandler()
 {
     ::pcr::FormComponentPropertyHandler::registerImplementation();
@@ -319,9 +317,7 @@ namespace pcr
         if ( PROPERTY_ID_IMAGE_URL == nPropId && ( _rValue >>= xGrfObj ) )
         {
             DBG_ASSERT( xGrfObj.is(), 
"FormComponentPropertyHandler::setPropertyValue() xGrfObj is invalid");
-            OUString sObjectID(  GRAPHOBJ_URLPREFIX  );
-            sObjectID = sObjectID + xGrfObj->getUniqueID();
-            m_xComponent->setPropertyValue( _rPropertyName, uno::makeAny( 
sObjectID ) );
+            m_xComponent->setPropertyValue(PROPERTY_GRAPHIC, 
uno::makeAny(xGrfObj->getGraphic()));
         }
         else if ( PROPERTY_ID_FONT == nPropId )
         {
@@ -2726,7 +2722,7 @@ namespace pcr
 
         OUString sCurValue;
         OSL_VERIFY( impl_getPropertyValue_throw( PROPERTY_IMAGE_URL ) >>= 
sCurValue );
-        if ( !sCurValue.isEmpty() && !sCurValue.startsWith(GRAPHOBJ_URLPREFIX) 
)
+        if (!sCurValue.isEmpty())
         {
             aFileDlg.SetDisplayDirectory( sCurValue );
             // TODO: need to set the display directory _and_ the default name
@@ -2743,12 +2739,11 @@ namespace pcr
             if ( !bIsLink )
             {
                 Graphic aGraphic;
-                aFileDlg.GetGraphic( aGraphic );
+                aFileDlg.GetGraphic(aGraphic);
 
                 Reference< graphic::XGraphicObject > xGrfObj = 
graphic::GraphicObject::create( m_xContext );
                 xGrfObj->setGraphic( aGraphic.GetXGraphic() );
 
-
                 _out_rNewValue <<= xGrfObj;
 
             }
diff --git a/extensions/source/propctrlr/formstrings.hxx 
b/extensions/source/propctrlr/formstrings.hxx
index a4d8955b348d..ad06d8989b32 100644
--- a/extensions/source/propctrlr/formstrings.hxx
+++ b/extensions/source/propctrlr/formstrings.hxx
@@ -73,6 +73,7 @@ namespace pcr
     #define PROPERTY_SUBMIT_METHOD          "SubmitMethod"
     #define PROPERTY_SUBMIT_ENCODING        "SubmitEncoding"
     #define PROPERTY_IMAGE_URL              "ImageURL"
+    #define PROPERTY_GRAPHIC                "Graphic"
     #define PROPERTY_EMPTY_IS_NULL          "ConvertEmptyToNull"
     #define PROPERTY_LISTSOURCETYPE         "ListSourceType"
     #define PROPERTY_LISTSOURCE             "ListSource"
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to