ooo-build r13362 - in trunk: . patches/dev300



Author: noelpwer
Date: Wed Jul 23 11:18:36 2008
New Revision: 13362
URL: http://svn.gnome.org/viewvc/ooo-build?rev=13362&view=rev

Log:
2008-07-22  Noel Power  <noel power novell com>

        * patches/dev300/controls-with-images-in-document.diff: updates 
        to use the simple unowrapper for the GraphicObject ( remove link
        dependency too )


Modified:
   trunk/ChangeLog
   trunk/patches/dev300/controls-with-images-in-document.diff

Modified: trunk/patches/dev300/controls-with-images-in-document.diff
==============================================================================
--- trunk/patches/dev300/controls-with-images-in-document.diff	(original)
+++ trunk/patches/dev300/controls-with-images-in-document.diff	Wed Jul 23 11:18:36 2008
@@ -17,17 +17,17 @@
          Reference< XComponentContext > xInspectorContext(
              ::cppu::createComponentContext( aHandlerContextInfo, sizeof( aHandlerContextInfo ) / sizeof( aHandlerContextInfo[0] ),
 diff --git extensions/source/propctrlr/formcomponenthandler.cxx extensions/source/propctrlr/formcomponenthandler.cxx
-index e8ef25c..0545cd2 100644
+index e8ef25c..df1b436 100644
 --- extensions/source/propctrlr/formcomponenthandler.cxx
 +++ extensions/source/propctrlr/formcomponenthandler.cxx
-@@ -113,6 +113,7 @@
- #include <tools/diagnose_ex.h>
- #include <cppuhelper/exc_hlp.hxx>
- #include <connectivity/dbconversion.hxx>
-+#include <goodies/grfmgr.hxx> // #TODO create UNO holder to get rid of link dep.
- 
- #include <limits>
- 
+@@ -80,6 +80,7 @@
+ #include <com/sun/star/inspection/PropertyLineElement.hpp>
+ #include <com/sun/star/resource/XStringResourceManager.hpp>
+ #include <com/sun/star/resource/MissingResourceException.hpp>
++#include <com/sun/star/graphic/GraphicObjectAccess.hpp>
+ /** === end UNO includes === **/
+ #include <connectivity/dbexception.hxx>
+ #include <vcl/wrkwin.hxx>
 @@ -1360,9 +1361,18 @@ namespace pcr
              break;
  
@@ -91,7 +91,7 @@
          }
  
          ::rtl::OUString sCurValue;
-@@ -2687,7 +2711,29 @@ namespace pcr
+@@ -2687,7 +2711,26 @@ namespace pcr
          _rClearBeforeDialog.clear();
          bool bSuccess = ( 0 == aFileDlg.Execute() );
          if ( bSuccess )
@@ -104,14 +104,11 @@
 +            {
 +                Graphic aGraphic;
 +                aFileDlg.GetGraphic( aGraphic );
-+                // #TODO create uno holder for GraphicObject so we don't
-+                // need to link goodies lib
-+                GraphicObject foo; // needs to be in-scope until toolkit grabs ImageURL prop value
-+                foo.SetGraphic( aGraphic );
++                // Hold GraphicObject instance here until the property is set
++                Reference< graphic::XGraphicObject > xGrfObj = graphic::GraphicObjectAccess::createGraphicObject( m_aContext.getUNOContext() );
++                xGrfObj->setGraphic( aGraphic.GetXGraphic() ); 
 +                rtl::OUString ObjectID( RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.GraphicObject:" ) );
-+                String id( foo.GetUniqueID().GetBuffer(), RTL_TEXTENCODING_ASCII_US );
-+
-+                ObjectID = ObjectID + id;;
++                ObjectID = ObjectID + xGrfObj->getUniqueID();
 +                 
 +                m_xComponent->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ImageURL" ) ), uno::makeAny( ObjectID ) );
 +            }
@@ -140,20 +137,6 @@
  
          /** executes a dialog which allows the user to change the TargetURL property of
              our component
-diff --git extensions/source/propctrlr/makefile.mk extensions/source/propctrlr/makefile.mk
-index 573f676..795916b 100644
---- extensions/source/propctrlr/makefile.mk
-+++ extensions/source/propctrlr/makefile.mk
-@@ -130,7 +130,8 @@ SHL1STDLIBS= \
- 		$(CPPUHELPERLIB) 	 \
- 		$(CPPULIB) 	\
- 		$(UNOTOOLSLIB) 	\
--		$(SALLIB)
-+		$(SALLIB) \
-+		$(GOODIESLIB)
- 
- SHL1LIBS=		$(SLB)$/$(TARGET).lib
- SHL1IMPLIB=		i$(TARGET)
 diff --git extensions/source/propctrlr/propcontroller.cxx extensions/source/propctrlr/propcontroller.cxx
 index 80c07a6..26eba26 100644
 --- extensions/source/propctrlr/propcontroller.cxx
@@ -259,157 +242,6 @@
  
  // -----------------
  // - ImageProducer -
-diff --git goodies/source/unographic/provider.cxx goodies/source/unographic/provider.cxx
-index f51b852..cf7d733 100644
---- goodies/source/unographic/provider.cxx
-+++ goodies/source/unographic/provider.cxx
-@@ -54,12 +54,15 @@
- 
- #include "descriptor.hxx"
- #include "graphic.hxx"
-+#include "grfmgr.hxx"
- #include "provider.hxx"
- 
- using namespace com::sun::star;
- 
- namespace unographic {
- 
-+#define UNO_NAME_GRAPHOBJ_URLPREFIX                             "vnd.sun.star.GraphicObject:"
-+
- // -------------------
- // - GraphicProvider -
- // -------------------
-@@ -176,6 +179,18 @@ uno::Reference< ::graphic::XGraphic > Gr
- 			xRet = pUnoGraphic;
- 		}
- 	}
-+	else if( rResourceURL.compareToAscii( UNO_NAME_GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( UNO_NAME_GRAPHOBJ_URLPREFIX ) ) == 0 )
-+	{
-+		// graphic manager url
-+		String aTmpStr( rResourceURL.copy( sizeof( UNO_NAME_GRAPHOBJ_URLPREFIX ) - 1 ) );
-+		ByteString aUniqueID( aTmpStr, RTL_TEXTENCODING_UTF8 );
-+		GraphicObject aGrafObj( aUniqueID );	
-+		// Don't call aGrafObj.GetXGraphic because it will call us back 		// here again ( albeit in the "private:memorygraphic" test 
-+		// above )
-+		::unographic::Graphic* pUnoGraphic = new ::unographic::Graphic;
-+		pUnoGraphic->init( aGrafObj.GetGraphic() );
-+		xRet = pUnoGraphic;
-+	}
- 	
- 	return xRet;
- }
-diff --git toolkit/inc/toolkit/controls/unocontrols.hxx toolkit/inc/toolkit/controls/unocontrols.hxx
-index 72c7db8..dc3f12c 100644
---- toolkit/inc/toolkit/controls/unocontrols.hxx
-+++ toolkit/inc/toolkit/controls/unocontrols.hxx
-@@ -64,9 +64,14 @@
- #include <cppuhelper/implbase2.hxx>
- #include <cppuhelper/implbase1.hxx>
- #include <comphelper/uno3.hxx>
-+#include <goodies/grfmgr.hxx>
-+
- 
- #include <list>
- 
-+#define UNO_NAME_GRAPHOBJ_URLPREFIX                             "vnd.sun.star.GraphicObject:"
-+#define UNO_NAME_GRAPHOBJ_URLPKGPREFIX                  "vnd.sun.star.Package:"
-+ 
- 
- //	----------------------------------------------------
- //	class UnoControlEditModel
-@@ -219,7 +224,8 @@ private:
- 	std::list< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > >  maListeners;
-     bool                                                                                    mbAdjustingImagePosition;
-     bool                                                                                    mbAdjustingGraphic;
--
-+    
-+    GraphicObject maObj;
- protected:
-     ImageProducerControlModel() : mbAdjustingImagePosition( false ), mbAdjustingGraphic( false ) { }
-     ImageProducerControlModel( const ImageProducerControlModel& _rSource ) : com::sun::star::awt::XImageProducer(), UnoControlModel( _rSource ), mbAdjustingImagePosition( false ), mbAdjustingGraphic( false ) { }
-diff --git toolkit/source/controls/dialogcontrol.cxx toolkit/source/controls/dialogcontrol.cxx
-index 3fd5723..fcf99e4 100644
---- toolkit/source/controls/dialogcontrol.cxx
-+++ toolkit/source/controls/dialogcontrol.cxx
-@@ -2118,7 +2118,8 @@ throw (RuntimeException)
- 	rbase  >>= baseLocation;
- 	rUrl  >>= url;
- 
--	if ( url.getLength() > 0 )
-+	// Don't adjust GraphicObject url(s)
-+	if ( url.getLength() > 0 && url.compareToAscii( UNO_NAME_GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( UNO_NAME_GRAPHOBJ_URLPREFIX ) ) != 0 )
- 	{
- 		INetURLObject urlObj(baseLocation);
- 		urlObj.removeSegment();
-diff --git toolkit/source/controls/unocontrols.cxx toolkit/source/controls/unocontrols.cxx
-index 821c1b9..b9a9f39 100644
---- toolkit/source/controls/unocontrols.cxx
-+++ toolkit/source/controls/unocontrols.cxx
-@@ -621,6 +621,18 @@ void SAL_CALL ImageProducerControlModel:
-                 mbAdjustingGraphic = true;
-                 ::rtl::OUString sImageURL;
-                 OSL_VERIFY( rValue >>= sImageURL );
-+
-+                if( ( sImageURL.compareToAscii( UNO_NAME_GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( UNO_NAME_GRAPHOBJ_URLPREFIX ) ) == 0 ) )
-+		{
-+		    // graphic manager url
-+                    rtl::OUString sURL = sImageURL.copy( sizeof( UNO_NAME_GRAPHOBJ_URLPREFIX ) - 1 );
-+                    String aTmpStr(sURL);
-+                    ByteString aUniqueID( aTmpStr, RTL_TEXTENCODING_UTF8 );
-+                    GraphicObject aGrafObj( aUniqueID );                
-+                    maObj = aGrafObj;
-+                }
-+                else // linked
-+                    maObj = GraphicObject(); // release managed graphic
-                 setPropertyValue( GetPropertyName( BASEPROPERTY_GRAPHIC ), uno::makeAny( lcl_getGraphicFromURL_nothrow( sImageURL ) ) );
-                 mbAdjustingGraphic = false;
-             }
-diff --git toolkit/util/makefile.mk toolkit/util/makefile.mk
-index 6bb43c4..156a93f 100644
---- toolkit/util/makefile.mk
-+++ toolkit/util/makefile.mk
-@@ -70,7 +70,12 @@ SHL1STDLIBS=\
- 		$(COMPHELPERLIB)	\
- 		$(CPPUHELPERLIB)	\
- 		$(CPPULIB)			\
--		$(SALLIB)
-+		$(SALLIB) \
-+                $(GOODIESLIB)
-+# yes I realise linking GOODIES is not very goody of me, but
-+# I would need to uno wrap some thing then in order to loose the dependency
-+# But... I am not sure yet if what I am doing is right
-+
- 
- SHL1LIBS=	$(LIB1TARGET)
- SHL1DEF=	$(MISC)$/$(SHL1TARGET).def
-diff --git xmloff/source/forms/elementimport.cxx xmloff/source/forms/elementimport.cxx
-index edc0c77..8903f74 100644
---- xmloff/source/forms/elementimport.cxx
-+++ xmloff/source/forms/elementimport.cxx
-@@ -1136,7 +1136,7 @@ namespace xmloff
- 		if ( bMakeAbsolute )
- 		{
- 			// make a global URL out of the local one
--			::rtl::OUString sAdjustedValue = m_rContext.getGlobalContext().GetAbsoluteReference( _rValue );
-+			::rtl::OUString sAdjustedValue = m_rContext.getGlobalContext().ResolveGraphicObjectURL( _rValue, FALSE );
- 			OImagePositionImport::handleAttribute( _nNamespaceKey, _rLocalName, sAdjustedValue );
- 		}
- 		else
-diff --git xmloff/source/forms/propertyexport.cxx xmloff/source/forms/propertyexport.cxx
-index bedd87f..0b5f7a7 100644
---- xmloff/source/forms/propertyexport.cxx
-+++ xmloff/source/forms/propertyexport.cxx
-@@ -429,7 +429,9 @@ namespace xmloff
- 			
- 		::rtl::OUString sTargetLocation = comphelper::getString(m_xProps->getPropertyValue(_sPropertyName));
-         if ( sTargetLocation.getLength() )
--		    sTargetLocation = m_rContext.getGlobalContext().GetRelativeReference(sTargetLocation);
-+                    // If this isn't a GraphicObject then GetRelativeReference
-+                    // will be called anyway ( in AddEmbeddedGraphic )
-+		    sTargetLocation = m_rContext.getGlobalContext().AddEmbeddedGraphicObject(sTargetLocation);
- 		AddAttribute(OAttributeMetaData::getCommonControlAttributeNamespace(_nProperty)
- 					,OAttributeMetaData::getCommonControlAttributeName(_nProperty)
- 					, sTargetLocation);
 diff --git goodies/source/unographic/graphicuno.cxx goodies/source/unographic/graphicuno.cxx
 index 645c048..b39f7a7 100755
 --- goodies/source/unographic/graphicuno.cxx
@@ -470,11 +302,11 @@
  }
   
 diff --git goodies/source/unographic/graphicunoaccess.cxx goodies/source/unographic/graphicunoaccess.cxx
-new file mode 100755
-index 0000000..83c43e4
+new file mode 100644
+index 0000000..2d5a8cf
 --- /dev/null
 +++ goodies/source/unographic/graphicunoaccess.cxx
-@@ -0,0 +1,100 @@
+@@ -0,0 +1,102 @@
 +/*************************************************************************
 + *
 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -510,7 +342,7 @@
 +#include "precompiled_goodies.hxx"
 +#include <comphelper/servicedecl.hxx>
 +#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/graphic/XGraphicObjectAccess.hpp>
++#include <com/sun/star/graphic/XGraphicObject.hpp>
 +#include <com/sun/star/lang/IllegalArgumentException.hpp>
 +#include "grfmgr.hxx"
 +
@@ -518,7 +350,7 @@
 +
 +namespace unographic {
 +
-+typedef ::cppu::WeakImplHelper1< graphic::XGraphicObjectAccess > GObjectAccess_BASE;
++typedef ::cppu::WeakImplHelper1< graphic::XGraphicObject > GObjectAccess_BASE;
 +
 +class GObjectAccessImpl : public GObjectAccess_BASE
 +{
@@ -526,7 +358,7 @@
 +public:
 +     GObjectAccessImpl( uno::Sequence< uno::Any > const & args, uno::Reference< uno::XComponentContext > const & xComponentContext ) throw (uno::RuntimeException);
 +
-+     // XGraphicObjectAccess
++     // XGraphicObject
 +    virtual uno::Reference< graphic::XGraphic > SAL_CALL getGraphic() throw (uno::RuntimeException);
 +    virtual void SAL_CALL setGraphic( const uno::Reference< graphic::XGraphic >& _graphic ) throw (uno::RuntimeException);
 +    ::rtl::OUString SAL_CALL getUniqueID() throw (uno::RuntimeException);
@@ -534,6 +366,7 @@
 +
 +GObjectAccessImpl::GObjectAccessImpl( uno::Sequence< uno::Any > const & args, uno::Reference< uno::XComponentContext > const & xComponentContext ) throw (uno::RuntimeException)
 +{
++    OSL_TRACE("In GObjectAccessImpl::GObjectAccessImpl argslength = %d", args.getLength());
 +    if ( args.getLength() == 1 )
 +    {
 +        rtl::OUString sId;
@@ -544,6 +377,7 @@
 +    }
 +    else
 +       mpGObject.reset( new GraphicObject() ); 
++    OSL_TRACE("In GObjectAccessImpl::GObjectAccessImpl complete");
 +}
 +
 +uno::Reference< graphic::XGraphic > SAL_CALL GObjectAccessImpl::getGraphic() throw (uno::RuntimeException)
@@ -572,7 +406,7 @@
 +
 +namespace sdecl = comphelper::service_decl;
 +sdecl::class_<GObjectAccessImpl, sdecl::with_args<true> > serviceBI;
-+extern sdecl::ServiceDecl const serviceDecl( serviceBI, "com.sun.star.graphic.GraphicAccess", "com.sun.star.graphic.GraphicAccess" );
++extern sdecl::ServiceDecl const serviceDecl( serviceBI, "com.sun.star.graphic.GraphicObjectAccess", "com.sun.star.graphic.GraphicObjectAccess" );
 +
 +}
 diff --git goodies/source/unographic/makefile.mk goodies/source/unographic/makefile.mk
@@ -595,9 +429,48 @@
  			$(SLO)$/transformer.obj
  
  # --- Target -------------------------------------------------------
+diff --git goodies/source/unographic/provider.cxx goodies/source/unographic/provider.cxx
+index f51b852..cf7d733 100644
+--- goodies/source/unographic/provider.cxx
++++ goodies/source/unographic/provider.cxx
+@@ -54,12 +54,15 @@
+ 
+ #include "descriptor.hxx"
+ #include "graphic.hxx"
++#include "grfmgr.hxx"
+ #include "provider.hxx"
+ 
+ using namespace com::sun::star;
+ 
+ namespace unographic {
+ 
++#define UNO_NAME_GRAPHOBJ_URLPREFIX                             "vnd.sun.star.GraphicObject:"
++
+ // -------------------
+ // - GraphicProvider -
+ // -------------------
+@@ -176,6 +179,18 @@ uno::Reference< ::graphic::XGraphic > Gr
+ 			xRet = pUnoGraphic;
+ 		}
+ 	}
++	else if( rResourceURL.compareToAscii( UNO_NAME_GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( UNO_NAME_GRAPHOBJ_URLPREFIX ) ) == 0 )
++	{
++		// graphic manager url
++		String aTmpStr( rResourceURL.copy( sizeof( UNO_NAME_GRAPHOBJ_URLPREFIX ) - 1 ) );
++		ByteString aUniqueID( aTmpStr, RTL_TEXTENCODING_UTF8 );
++		GraphicObject aGrafObj( aUniqueID );	
++		// Don't call aGrafObj.GetXGraphic because it will call us back 		// here again ( albeit in the "private:memorygraphic" test 
++		// above )
++		::unographic::Graphic* pUnoGraphic = new ::unographic::Graphic;
++		pUnoGraphic->init( aGrafObj.GetGraphic() );
++		xRet = pUnoGraphic;
++	}
+ 	
+ 	return xRet;
+ }
 diff --git offapi/com/sun/star/graphic/GraphicObjectAccess.idl offapi/com/sun/star/graphic/GraphicObjectAccess.idl
-new file mode 100755
-index 0000000..04fa387
+new file mode 100644
+index 0000000..a01e2cd
 --- /dev/null
 +++ offapi/com/sun/star/graphic/GraphicObjectAccess.idl
 @@ -0,0 +1,47 @@
@@ -634,12 +507,12 @@
 +#ifndef com_sun_star_graphic_GraphicObjectAccess_idl
 +#define com_sun_star_graphic_GraphicObjectAccess_idl
 +
-+#include <com/sun/star/graphic/XGraphicObjectAccess.idl>
++#include <com/sun/star/graphic/XGraphicObject.idl>
 +
 +module com { module sun { module star { module graphic
 +{
 +
-+service GraphicObjectAccess : XGraphicObjectAccess
++service GraphicObjectAccess : XGraphicObject
 +{
 +    createGraphicObject();
 +    createGraphicObjectWithId( [in] string uniqueId );
@@ -648,11 +521,11 @@
 +} ; } ; } ; } ; 
 +
 +#endif
-diff --git offapi/com/sun/star/graphic/XGraphicObjectAccess.idl offapi/com/sun/star/graphic/XGraphicObjectAccess.idl
-new file mode 100755
-index 0000000..c8bea43
+diff --git offapi/com/sun/star/graphic/XGraphicObject.idl offapi/com/sun/star/graphic/XGraphicObject.idl
+new file mode 100644
+index 0000000..97b4920
 --- /dev/null
-+++ offapi/com/sun/star/graphic/XGraphicObjectAccess.idl
++++ offapi/com/sun/star/graphic/XGraphicObject.idl
 @@ -0,0 +1,47 @@
 +/*************************************************************************
 + *
@@ -684,15 +557,15 @@
 + *
 + ************************************************************************/
 +
-+#ifndef com_sun_star_graphic_XGraphicObjectAccess_idl
-+#define com_sun_star_graphic_XGraphicObjectAccess_idl
++#ifndef com_sun_star_graphic_XGraphicObject_idl
++#define com_sun_star_graphic_XGraphicObject_idl
 +
 +#include <com/sun/star/uno/XInterface.idl>
 +
 +module com { module sun { module star { module graphic
 +{
 +interface XGraphic;
-+interface XGraphicObjectAccess : ::com::sun::star::uno::XInterface
++interface XGraphicObject : ::com::sun::star::uno::XInterface
 +{
 +    [attribute ] XGraphic Graphic;
 +    [attribute, readonly ] string UniqueID;
@@ -702,15 +575,119 @@
 +
 +#endif
 diff --git offapi/com/sun/star/graphic/makefile.mk offapi/com/sun/star/graphic/makefile.mk
-index 600f60d..8bfa997 100755
+index 600f60d..9224b90 100755
 --- offapi/com/sun/star/graphic/makefile.mk
 +++ offapi/com/sun/star/graphic/makefile.mk
 @@ -53,6 +53,8 @@ IDLFILES= \
  	XGraphic.idl \
  	XGraphicProvider.idl \
  	XGraphicRenderer.idl \
-+	XGraphicObjectAccess.idl \
++	XGraphicObject.idl \
 +	GraphicObjectAccess.idl \
  	XGraphicTransformer.idl
  	
  # --- Targets ------------------------------------------------------
+diff --git toolkit/inc/toolkit/controls/unocontrols.hxx toolkit/inc/toolkit/controls/unocontrols.hxx
+index 72c7db8..29ef91a 100644
+--- toolkit/inc/toolkit/controls/unocontrols.hxx
++++ toolkit/inc/toolkit/controls/unocontrols.hxx
+@@ -54,6 +54,7 @@
+ #include <com/sun/star/awt/XCurrencyField.hpp>
+ #include <com/sun/star/awt/XPatternField.hpp>
+ #include <com/sun/star/awt/XProgressBar.hpp>
++#include <com/sun/star/graphic/XGraphicObject.hpp>
+ #include <toolkit/controls/unocontrolmodel.hxx>
+ #include <toolkit/controls/unocontrolbase.hxx>
+ #include <toolkit/helper/macros.hxx>
+@@ -67,6 +68,9 @@
+ 
+ #include <list>
+ 
++#define UNO_NAME_GRAPHOBJ_URLPREFIX                             "vnd.sun.star.GraphicObject:"
++#define UNO_NAME_GRAPHOBJ_URLPKGPREFIX                  "vnd.sun.star.Package:"
++ 
+ 
+ //	----------------------------------------------------
+ //	class UnoControlEditModel
+@@ -219,7 +223,8 @@ private:
+ 	std::list< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > >  maListeners;
+     bool                                                                                    mbAdjustingImagePosition;
+     bool                                                                                    mbAdjustingGraphic;
+-
++    
++    ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphicObject > mxGrfObj;
+ protected:
+     ImageProducerControlModel() : mbAdjustingImagePosition( false ), mbAdjustingGraphic( false ) { }
+     ImageProducerControlModel( const ImageProducerControlModel& _rSource ) : com::sun::star::awt::XImageProducer(), UnoControlModel( _rSource ), mbAdjustingImagePosition( false ), mbAdjustingGraphic( false ) { }
+diff --git toolkit/source/controls/dialogcontrol.cxx toolkit/source/controls/dialogcontrol.cxx
+index 3fd5723..fcf99e4 100644
+--- toolkit/source/controls/dialogcontrol.cxx
++++ toolkit/source/controls/dialogcontrol.cxx
+@@ -2118,7 +2118,8 @@ throw (RuntimeException)
+ 	rbase  >>= baseLocation;
+ 	rUrl  >>= url;
+ 
+-	if ( url.getLength() > 0 )
++	// Don't adjust GraphicObject url(s)
++	if ( url.getLength() > 0 && url.compareToAscii( UNO_NAME_GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( UNO_NAME_GRAPHOBJ_URLPREFIX ) ) != 0 )
+ 	{
+ 		INetURLObject urlObj(baseLocation);
+ 		urlObj.removeSegment();
+diff --git toolkit/source/controls/unocontrols.cxx toolkit/source/controls/unocontrols.cxx
+index 821c1b9..8412a98 100644
+--- toolkit/source/controls/unocontrols.cxx
++++ toolkit/source/controls/unocontrols.cxx
+@@ -37,6 +37,7 @@
+ #include <com/sun/star/awt/VisualEffect.hpp>
+ #include <com/sun/star/awt/LineEndFormat.hpp>
+ #include <com/sun/star/graphic/XGraphicProvider.hpp>
++#include <com/sun/star/graphic/GraphicObjectAccess.hpp>
+ #include <com/sun/star/util/Date.hpp>
+ 
+ 
+@@ -621,6 +622,17 @@ void SAL_CALL ImageProducerControlModel:
+                 mbAdjustingGraphic = true;
+                 ::rtl::OUString sImageURL;
+                 OSL_VERIFY( rValue >>= sImageURL );
++
++                if( ( sImageURL.compareToAscii( UNO_NAME_GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( UNO_NAME_GRAPHOBJ_URLPREFIX ) ) == 0 ) )
++		{
++		    // graphic manager uniqueid
++                    rtl::OUString sID = sImageURL.copy( sizeof( UNO_NAME_GRAPHOBJ_URLPREFIX ) - 1 );
++                    // get the DefaultContext
++                    ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
++                    mxGrfObj = graphic::GraphicObjectAccess::createGraphicObjectWithId( aContext.getUNOContext(), sID );
++                }
++                else // linked
++                    mxGrfObj = NULL; // release the GraphicObject
+                 setPropertyValue( GetPropertyName( BASEPROPERTY_GRAPHIC ), uno::makeAny( lcl_getGraphicFromURL_nothrow( sImageURL ) ) );
+                 mbAdjustingGraphic = false;
+             }
+diff --git xmloff/source/forms/elementimport.cxx xmloff/source/forms/elementimport.cxx
+index edc0c77..8903f74 100644
+--- xmloff/source/forms/elementimport.cxx
++++ xmloff/source/forms/elementimport.cxx
+@@ -1136,7 +1136,7 @@ namespace xmloff
+ 		if ( bMakeAbsolute )
+ 		{
+ 			// make a global URL out of the local one
+-			::rtl::OUString sAdjustedValue = m_rContext.getGlobalContext().GetAbsoluteReference( _rValue );
++			::rtl::OUString sAdjustedValue = m_rContext.getGlobalContext().ResolveGraphicObjectURL( _rValue, FALSE );
+ 			OImagePositionImport::handleAttribute( _nNamespaceKey, _rLocalName, sAdjustedValue );
+ 		}
+ 		else
+diff --git xmloff/source/forms/propertyexport.cxx xmloff/source/forms/propertyexport.cxx
+index bedd87f..0b5f7a7 100644
+--- xmloff/source/forms/propertyexport.cxx
++++ xmloff/source/forms/propertyexport.cxx
+@@ -429,7 +429,9 @@ namespace xmloff
+ 			
+ 		::rtl::OUString sTargetLocation = comphelper::getString(m_xProps->getPropertyValue(_sPropertyName));
+         if ( sTargetLocation.getLength() )
+-		    sTargetLocation = m_rContext.getGlobalContext().GetRelativeReference(sTargetLocation);
++                    // If this isn't a GraphicObject then GetRelativeReference
++                    // will be called anyway ( in AddEmbeddedGraphic )
++		    sTargetLocation = m_rContext.getGlobalContext().AddEmbeddedGraphicObject(sTargetLocation);
+ 		AddAttribute(OAttributeMetaData::getCommonControlAttributeNamespace(_nProperty)
+ 					,OAttributeMetaData::getCommonControlAttributeName(_nProperty)
+ 					, sTargetLocation);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]