ooo-build r13115 - trunk/patches/test/vba
- From: noelpwer svn gnome org
- To: svn-commits-list gnome org
- Subject: ooo-build r13115 - trunk/patches/test/vba
- Date: Tue, 8 Jul 2008 10:40:33 +0000 (UTC)
Author: noelpwer
Date: Tue Jul 8 10:40:33 2008
New Revision: 13115
URL: http://svn.gnome.org/viewvc/ooo-build?rev=13115&view=rev
Log:
changes to support the link/no link checkbox ( and to ripple the
associated changes down the code ) also major clean up of the patch (
some util functions still need a proper home ) also export to odf not
done yet ( patch also doesn't support dialogs, although the changes are
in a previous version of this patch )
Modified:
trunk/patches/test/vba/HackyImageControlWithNonLinkedImages.diff
Modified: trunk/patches/test/vba/HackyImageControlWithNonLinkedImages.diff
==============================================================================
--- trunk/patches/test/vba/HackyImageControlWithNonLinkedImages.diff (original)
+++ trunk/patches/test/vba/HackyImageControlWithNonLinkedImages.diff Tue Jul 8 10:40:33 2008
@@ -1,80 +1,46 @@
-diff --git forms/source/component/ImageControl.cxx forms/source/component/ImageControl.cxx
-index 1ba9f90..6db2387 100644
---- forms/source/component/ImageControl.cxx
-+++ forms/source/component/ImageControl.cxx
-@@ -43,6 +43,8 @@
- #include <svtools/imageresourceaccess.hxx>
- #include <unotools/ucblockbytes.hxx>
- #include <sfx2/filedlghelper.hxx>
+diff --git a/forms/source/component/ImageControl.cxx b/forms/source/component/ImageControl.cxx
+index 1ba9f90..03499a1 100644
+--- a/forms/source/component/ImageControl.cxx
++++ b/forms/source/component/ImageControl.cxx
+@@ -57,6 +57,9 @@
+ #include <com/sun/star/io/NotConnectedException.hpp>
+ #include <com/sun/star/beans/PropertyValue.hpp>
+ #include <com/sun/star/graphic/XGraphic.hpp>
+#include <com/sun/star/graphic/XGraphicLinkProvider.hpp>
+#include <com/sun/star/embed/ElementModes.hpp>
- #include <com/sun/star/awt/XPopupMenu.hpp>
- #include <com/sun/star/awt/PopupMenuDirection.hpp>
- #include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
-@@ -352,7 +354,51 @@ sal_Bool OImageControlModel::handleNewIm
- // create a stream for the image specified by the URL
++
+ #include <tools/urlobj.hxx>
+ #include <tools/stream.hxx>
+ #include <tools/debug.hxx>
+@@ -353,13 +356,23 @@ sal_Bool OImageControlModel::handleNewIm
::std::auto_ptr< SvStream > pImageStream;
Reference< XInputStream > xImageStream;
-+ String aUserData = _rURL;
-+ Reference< graphic::XGraphicLinkProvider > xProv;
-+
-+ getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("GraphicLinkProvider" ) ) ) >>= xProv;
-+ OSL_TRACE("GraphicLinkProvider.is %d", xProv.is() );
-+ if ( xProv.is() && _rURL.toAsciiLowerCase().indexOf( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.package:") ) ) == 0 )
-+ {
-+ Reference< embed::XStorage > xStor( xProv->getStorage() );
-+ String aUserData = _rURL;
-+ if( aUserData.Len() )
-+ {
-+ const String aPicturePath( aUserData.GetToken( 1, ':' ) );
-+
-+ // graphic from picture stream in picture storage in XML package
-+ if( aPicturePath.GetTokenCount( '/' ) == 2 )
-+ {
-+ const String aPictureStreamName( aPicturePath.GetToken( 1, '/' ) );
-+ const String aPictureStorageName( aPicturePath.GetToken( 0, '/' ) );
-+
-+ try {
-+ if ( xStor->isStorageElement( aPictureStorageName ) )
-+ {
-+ uno::Reference< embed::XStorage > xPictureStorage =
-+ xStor->openStorageElement( aPictureStorageName, embed::ElementModes::READ );
-+ if( xPictureStorage.is() &&
-+ xPictureStorage->isStreamElement( aPictureStreamName ) )
-+ {
-+ uno::Reference< io::XStream > xStream = xPictureStorage->openStreamElement( aPictureStreamName, embed::ElementModes::READ );
-+ if ( xStream.is() )
-+ {
-+ pImageStream.reset( ::utl::UcbStreamHelper::CreateStream( xStream ) );
-+
-+ }
-+ }
-+ }
-+ }
-+ catch( uno::Exception& )
-+ {
-+ }
-+ }
-+ }
-+ }
-+if ( !pImageStream.get() )
-+{
- if ( ::svt::ImageResourceAccess::isImageResourceURL( _rURL ) )
+- if ( ::svt::ImageResourceAccess::isImageResourceURL( _rURL ) )
++ Reference< graphic::XGraphicLinkProvider > xProv;
++ m_xAggregateSet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("GraphicLinkProvider" ) ) ) >>= xProv;
++ if ( xProv.is() && utl::SvPictureStreamHelper::IsPackagePictureURL( _rURL ) )
{
- xImageStream = ::svt::ImageResourceAccess::getImageXStream( getORB(), _rURL );
-@@ -360,8 +406,9 @@ sal_Bool OImageControlModel::handleNewIm
- else
+- xImageStream = ::svt::ImageResourceAccess::getImageXStream( getORB(), _rURL );
++ pImageStream.reset( utl::SvPictureStreamHelper::GetStreamFromPackagePictureURL( _rURL, xProv->getStorage() ) );
+ }
+- else
++ if ( !pImageStream.get() )
{
- pImageStream.reset( ::utl::UcbStreamHelper::CreateStream( _rURL, STREAM_READ ) );
+- pImageStream.reset( ::utl::UcbStreamHelper::CreateStream( _rURL, STREAM_READ ) );
++ if ( ::svt::ImageResourceAccess::isImageResourceURL( _rURL ) )
++ {
++ xImageStream = ::svt::ImageResourceAccess::getImageXStream( getORB(), _rURL );
++ }
++ else
++ {
++ pImageStream.reset( ::utl::UcbStreamHelper::CreateStream( _rURL, STREAM_READ ) );
++ }
+ }
-+}
sal_Bool bSetNull = ( pImageStream.get() == NULL ) || ( ERRCODE_NONE != pImageStream->GetErrorCode() );
--
+
if (!bSetNull)
- {
- // get the size of the stream
-@@ -373,7 +420,6 @@ sal_Bool OImageControlModel::handleNewIm
+@@ -373,7 +386,6 @@ sal_Bool OImageControlModel::handleNewIm
xImageStream = new ::utl::OInputStreamHelper( new SvLockBytes( pImageStream.get(), sal_False ), nSize );
}
@@ -82,193 +48,66 @@
if ( xImageStream.is() )
{
-diff --git forms/source/component/imgprod.cxx forms/source/component/imgprod.cxx
-index 01fa8ac..8c7e065 100644
---- forms/source/component/imgprod.cxx
-+++ forms/source/component/imgprod.cxx
-@@ -39,12 +39,16 @@
- #include <unotools/ucbstreamhelper.hxx>
- #include <svtools/filter.hxx>
- #include <com/sun/star/io/XInputStream.hpp>
-+#include <com/sun/star/embed/XStorage.hpp>
-+#include <com/sun/star/embed/ElementModes.hpp>
-
- #ifndef SVTOOLS_SOURCE_MISC_IMAGERESOURCEACCESS_HXX
- #include "svtools/imageresourceaccess.hxx"
- #endif
- #include <comphelper/processfactory.hxx>
+diff --git a/forms/source/component/imgprod.cxx b/forms/source/component/imgprod.cxx
+index 01fa8ac..503fb6c 100644
+--- a/forms/source/component/imgprod.cxx
++++ b/forms/source/component/imgprod.cxx
+@@ -49,6 +49,8 @@
+ // - ImgProdLockBytes -
+ // --------------------
+using namespace com::sun::star;
+
- // --------------------
- // - ImgProdLockBytes -
- // --------------------
-@@ -644,6 +648,48 @@ void ImageProducer::initialize( const ::
+ class ImgProdLockBytes : public SvLockBytes
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > xStmRef;
+@@ -644,6 +646,21 @@ void ImageProducer::initialize( const ::
SetImage( aURL );
}
}
-+ if ( aArguments.getLength() == 2 )
++ else if ( aArguments.getLength() == 2 )
+ {
+ rtl::OUString aURL;
+ uno::Reference< embed::XStorage > xStor;
+ if ( ( aArguments[ 0 ] >>= aURL ) && ( aArguments[ 1 ] >>= xStor ) )
+ {
-+ String aUserData = aURL;
-+ if( aUserData.Len() && ( aUserData.GetToken( 0, ':' ) == String( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.Package" ) ) ) )
++ if ( utl::SvPictureStreamHelper::IsPackagePictureURL( aURL ) )
+ {
-+ const String aPicturePath( aUserData.GetToken( 1, ':' ) );
-+
-+ // graphic from picture stream in picture storage in XML package
-+ if( aPicturePath.GetTokenCount( '/' ) == 2 )
-+ {
-+ const String aPictureStreamName( aPicturePath.GetToken( 1, '/' ) );
-+ const String aPictureStorageName( aPicturePath.GetToken( 0, '/' ) );
-+
-+ try {
-+ if ( xStor->isStorageElement( aPictureStorageName ) )
-+ {
-+ uno::Reference< embed::XStorage > xPictureStorage =
-+ xStor->openStorageElement( aPictureStorageName, embed::ElementModes::READ );
-+ if( xPictureStorage.is() &&
-+ xPictureStorage->isStreamElement( aPictureStreamName ) )
-+ {
-+ uno::Reference< io::XStream > xStream =
-+ xPictureStorage->openStreamElement( aPictureStreamName, embed::ElementModes::READ );
-+ if ( xStream.is() )
-+ {
-+ uno::Reference< io::XInputStream > xIs( xStream->getInputStream() );
-+ setImage( xIs );
-+ }
-+ }
-+ }
-+ }
-+ catch( uno::Exception& )
-+ {
-+ }
-+ }
-+ }
++ std::auto_ptr< SvStream > pIs( utl::SvPictureStreamHelper::GetStreamFromPackagePictureURL( aURL, xStor ) );
++ SetImage( *pIs );
++ }
++ else
++ SetImage( aURL );
+ }
+ }
}
namespace frm
-diff --git forms/source/inc/frm_strings.hxx forms/source/inc/frm_strings.hxx
-index 7b1677d..a29cf97 100644
---- forms/source/inc/frm_strings.hxx
-+++ forms/source/inc/frm_strings.hxx
-@@ -144,6 +144,7 @@ namespace frm
- FORMS_CONSTASCII_STRING( PROPERTY_SUBMIT_METHOD, "SubmitMethod" );
- FORMS_CONSTASCII_STRING( PROPERTY_SUBMIT_ENCODING, "SubmitEncoding" );
- FORMS_CONSTASCII_STRING( PROPERTY_IMAGE_URL, "ImageURL" );
-+ FORMS_CONSTASCII_STRING( PROPERTY_GRAPHICLINKPROVIDER, "GraphicLinkProvider" );
- FORMS_CONSTASCII_STRING( PROPERTY_IMAGE_POSITION, "ImagePosition" );
- FORMS_CONSTASCII_STRING( PROPERTY_EMPTY_IS_NULL, "ConvertEmptyToNull" );
- FORMS_CONSTASCII_STRING( PROPERTY_LISTSOURCETYPE, "ListSourceType" );
-diff --git goodies/source/unographic/descriptor.cxx goodies/source/unographic/descriptor.cxx
-index 37721e1..d902d51 100644
---- goodies/source/unographic/descriptor.cxx
-+++ goodies/source/unographic/descriptor.cxx
-@@ -51,6 +51,7 @@
- #ifndef _COM_SUN_STAR_GRAPHIC_GRAPHICTYPE_HDL_
- #include <com/sun/star/graphic/GraphicType.hpp>
- #endif
-+#include <com/sun/star/embed/ElementModes.hpp>
- #include "vcl/graph.hxx"
- #include "vcl/svapp.hxx"
-
-@@ -125,6 +126,50 @@ void GraphicDescriptor::init( const uno:
- }
- }
-
-+void GraphicDescriptor::init( const uno::Reference< embed::XStorage >& xStorage, const ::rtl::OUString& rURL )
-+ throw()
-+{
-+ String aUserData = rURL;
-+ if( aUserData.Len() && ( aUserData.GetToken( 0, ':' ) == String( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.Package" ) ) ) )
-+ {
-+ const String aPicturePath( aUserData.GetToken( 1, ':' ) );
-+
-+ // graphic from picture stream in picture storage in XML package
-+ if( aPicturePath.GetTokenCount( '/' ) == 2 )
-+ {
-+ const String aPictureStreamName( aPicturePath.GetToken( 1, '/' ) );
-+ const String aPictureStorageName( aPicturePath.GetToken( 0, '/' ) );
-+
-+ try {
-+ if ( xStorage->isStorageElement( aPictureStorageName ) )
-+ {
-+ uno::Reference< embed::XStorage > xPictureStorage =
-+ xStorage->openStorageElement( aPictureStorageName, embed::ElementModes::READ );
-+ if( xPictureStorage.is() &&
-+ xPictureStorage->isStreamElement( aPictureStreamName ) )
-+ {
-+ uno::Reference< io::XStream > xStream =
-+ xPictureStorage->openStreamElement( aPictureStreamName, embed::ElementModes::READ );
-+ if ( xStream.is() )
-+ {
-+ SvStream* pIStm = ::utl::UcbStreamHelper::CreateStream( xStream );
-+
-+ if( pIStm )
-+ {
-+ implCreate( *pIStm, &rURL );
-+ delete pIStm;
-+ }
-+ }
-+ }
-+ }
-+ }
-+ catch( uno::Exception& )
-+ {
-+ }
-+ }
-+
-+ }
-+}
- // ------------------------------------------------------------------------------
-
- bool GraphicDescriptor::isValid() const
-diff --git goodies/source/unographic/descriptor.hxx goodies/source/unographic/descriptor.hxx
-index c683e18..8e7ae70 100644
---- goodies/source/unographic/descriptor.hxx
-+++ goodies/source/unographic/descriptor.hxx
-@@ -33,6 +33,7 @@
-
- #include <comphelper/propertysethelper.hxx>
- #include <com/sun/star/lang/XServiceInfo.hpp>
-+#include <com/sun/star/embed/XStorage.hpp>
-
- #include <comphelper/propertysetinfo.hxx>
- #include <vcl/graph.hxx>
-@@ -90,6 +91,7 @@ public:
- void init( const ::Graphic& rGraphic ) throw();
- void init( const ::rtl::OUString& rURL ) throw();
- void init( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxIStm, const ::rtl::OUString& rURL ) throw();
-+ void init( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& rxIStm, const ::rtl::OUString& rURL ) throw();
-
- bool isValid() const;
-
-diff --git goodies/source/unographic/provider.cxx goodies/source/unographic/provider.cxx
-index f51b852..e779449 100644
---- goodies/source/unographic/provider.cxx
-+++ goodies/source/unographic/provider.cxx
-@@ -51,6 +51,8 @@
- #include <vcl/virdev.hxx>
+diff --git a/goodies/source/unographic/descriptor.cxx b/goodies/source/unographic/descriptor.cxx
+diff --git a/goodies/source/unographic/descriptor.hxx b/goodies/source/unographic/descriptor.hxx
+diff --git a/goodies/source/unographic/provider.cxx b/goodies/source/unographic/provider.cxx
+index f51b852..5f79bdd 100644
+--- a/goodies/source/unographic/provider.cxx
++++ b/goodies/source/unographic/provider.cxx
+@@ -52,6 +52,8 @@
#include <com/sun/star/io/XStream.hpp>
#include <com/sun/star/text/GraphicCrop.hpp>
-+#include <com/sun/star/embed/XStorage.hpp>
-+#include <com/sun/star/embed/ElementModes.hpp>
++#include <comphelper/storagehelper.hxx>
++
#include "descriptor.hxx"
#include "graphic.hxx"
-@@ -319,6 +321,7 @@ uno::Reference< beans::XPropertySet > SA
+ #include "provider.hxx"
+@@ -319,7 +321,7 @@ uno::Reference< beans::XPropertySet > SA
::rtl::OUString aURL;
uno::Reference< io::XInputStream > xIStm;
+-
+ uno::Reference< embed::XStorage > xStor;
-
for( sal_Int32 i = 0; ( i < rMediaProperties.getLength() ) && !xRet.is(); ++i )
{
-@@ -333,6 +336,10 @@ uno::Reference< beans::XPropertySet > SA
+ const ::rtl::OUString aName( rMediaProperties[ i ].Name );
+@@ -333,9 +335,34 @@ uno::Reference< beans::XPropertySet > SA
{
aValue >>= xIStm;
}
@@ -277,61 +116,35 @@
+ aValue >>= xStor;
+ }
}
-
- if( xIStm.is() )
-@@ -343,26 +350,35 @@ uno::Reference< beans::XPropertySet > SA
- }
- else if( aURL.getLength() )
- {
-- uno::Reference< ::graphic::XGraphic > xGraphic( implLoadMemory( aURL ) );
--
-- if( !xGraphic.is() )
-- xGraphic = implLoadResource( aURL );
--
-- if ( !xGraphic.is() )
-- xGraphic = implLoadRepositoryImage( aURL );
--
-- if ( !xGraphic.is() )
-- xGraphic = implLoadStandardImage( aURL );
--
-- if( xGraphic.is() )
-+ if ( xStor.is() )
- {
-- xRet = uno::Reference< beans::XPropertySet >( xGraphic, uno::UNO_QUERY );
-+ GraphicDescriptor* pDescriptor = new GraphicDescriptor;
-+ pDescriptor->init( xStor, aURL );
-+ xRet = pDescriptor;
- }
- else
- {
-- GraphicDescriptor* pDescriptor = new GraphicDescriptor;
-- pDescriptor->init( aURL );
-- xRet = pDescriptor;
-+ uno::Reference< ::graphic::XGraphic > xGraphic( implLoadMemory( aURL ) );
-+
-+ if( !xGraphic.is() )
-+ xGraphic = implLoadResource( aURL );
-+
-+ if ( !xGraphic.is() )
-+ xGraphic = implLoadRepositoryImage( aURL );
+-
+- if( xIStm.is() )
+
-+ if ( !xGraphic.is() )
-+ xGraphic = implLoadStandardImage( aURL );
++ if ( xStor.is() && ::utl::SvPictureStreamHelper::IsPackagePictureURL( aURL ) )
++ {
++ // #TODO some asserts or something if xStream or xIStm are null
++ // #TODO - this is duplicated in queryGraphic below ( move to common func )
++ std::auto_ptr< SvStream > pIStm;
++ ::GraphicFilter* pFilter = ::GraphicFilter::GetGraphicFilter();
+
-+ if( xGraphic.is() )
-+ {
-+ xRet = uno::Reference< beans::XPropertySet >( xGraphic, uno::UNO_QUERY );
-+ }
-+ else
++ if( pFilter )
++ {
++ ::Graphic aVCLGraphic;
++
++ if( ( pFilter->ImportGraphic( aVCLGraphic, aURL, *pIStm ) == GRFILTER_OK ) &&
++ ( aVCLGraphic.GetType() != GRAPHIC_NONE ) )
+ {
-+ GraphicDescriptor* pDescriptor = new GraphicDescriptor;
-+ pDescriptor->init( aURL );
-+ xRet = pDescriptor;
++ ::unographic::Graphic* pUnoGraphic = new ::unographic::Graphic;
++
++ pUnoGraphic->init( aVCLGraphic );
++ xRet = pUnoGraphic;
+ }
- }
- }
-
-@@ -379,6 +395,7 @@ uno::Reference< ::graphic::XGraphic > SA
++ }
++ }
++ else if( xIStm.is() )
+ {
+ GraphicDescriptor* pDescriptor = new GraphicDescriptor;
+ pDescriptor->init( xIStm, aURL );
+@@ -379,6 +406,7 @@ uno::Reference< ::graphic::XGraphic > SA
SvStream* pIStm = NULL;
uno::Reference< io::XInputStream > xIStm;
@@ -339,7 +152,7 @@
for( sal_Int32 i = 0; ( i < rMediaProperties.getLength() ) && !pIStm && !xRet.is(); ++i )
{
-@@ -395,16 +412,55 @@ uno::Reference< ::graphic::XGraphic > SA
+@@ -395,12 +423,22 @@ uno::Reference< ::graphic::XGraphic > SA
{
aValue >>= xIStm;
}
@@ -349,58 +162,32 @@
+ }
}
++
if( xIStm.is() )
{
pIStm = ::utl::UcbStreamHelper::CreateStream( xIStm );
}
-+ else if( aPath.Len() && xStor.is() )
-+ {
-+ String aUserData = aPath;
-+ if( aUserData.Len() && ( aUserData.GetToken( 0, ':' ) == String( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.Package" ) ) ) )
-+ {
-+ const String aPicturePath( aUserData.GetToken( 1, ':' ) );
+
-+ // graphic from picture stream in picture storage in XML package
-+ if( aPicturePath.GetTokenCount( '/' ) == 2 )
-+ {
-+ const String aPictureStreamName( aPicturePath.GetToken( 1, '/' ) );
-+ const String aPictureStorageName( aPicturePath.GetToken( 0, '/' ) );
-+
-+ try {
-+ if ( xStor->isStorageElement( aPictureStorageName ) )
-+ {
-+ uno::Reference< embed::XStorage > xPictureStorage =
-+ xStor->openStorageElement( aPictureStorageName, embed::ElementModes::READ );
-+ if( xPictureStorage.is() &&
-+ xPictureStorage->isStreamElement( aPictureStreamName ) )
-+ {
-+ uno::Reference< io::XStream > xStream =
-+ xPictureStorage->openStreamElement( aPictureStreamName, embed::ElementModes::READ );
-+ if ( xStream.is() )
-+ pIStm = ::utl::UcbStreamHelper::CreateStream( xStream );
-+ }
-+ }
-+ }
-+ catch( uno::Exception& )
-+ {
-+ }
-+ }
-+ }
-+ }
++ else if ( xStor.is() && utl::SvPictureStreamHelper::IsPackagePictureURL( aPath ) )
++ {
++ pIStm = ::utl::SvPictureStreamHelper::GetStreamFromPackagePictureURL( aPath, xStor );
++ }
else if( aPath.Len() )
{
-- xRet = implLoadMemory( aPath );
--
-+ if( !xRet.is() )
-+ xRet = implLoadMemory( aPath );
-+
- if( !xRet.is() )
- xRet = implLoadResource( aPath );
+ xRet = implLoadMemory( aPath );
+@@ -434,6 +472,8 @@ uno::Reference< ::graphic::XGraphic > SA
+ pUnoGraphic->init( aVCLGraphic );
+ xRet = pUnoGraphic;
+ }
++ if ( xStor.is() )
++ OSL_TRACE("**** xRet is %d", xRet.is() );
+ }
-diff --git offapi/com/sun/star/graphic/makefile.mk offapi/com/sun/star/graphic/makefile.mk
+ delete pIStm;
+diff --git a/offapi/com/sun/star/graphic/makefile.mk b/offapi/com/sun/star/graphic/makefile.mk
index 600f60d..94abf95 100755
---- offapi/com/sun/star/graphic/makefile.mk
-+++ offapi/com/sun/star/graphic/makefile.mk
+--- a/offapi/com/sun/star/graphic/makefile.mk
++++ b/offapi/com/sun/star/graphic/makefile.mk
@@ -53,7 +53,8 @@ IDLFILES= \
XGraphic.idl \
XGraphicProvider.idl \
@@ -411,40 +198,61 @@
# --- Targets ------------------------------------------------------
-diff --git svx/util/makefile.mk svx/util/makefile.mk
-index 10100ae..df47081 100644
---- svx/util/makefile.mk
-+++ svx/util/makefile.mk
-@@ -176,6 +176,7 @@ SHL2STDLIBS= \
- $(VOSLIB) \
- $(SALLIB) \
- $(JVMFWKLIB) \
-+ $(CPPUHELPERLIB) \
- $(ICUUCLIB)
-
- .IF "$(GUI)"=="WNT"
-diff --git toolkit/inc/toolkit/controls/unocontrols.hxx toolkit/inc/toolkit/controls/unocontrols.hxx
-index 72c7db8..23cdb87 100644
---- toolkit/inc/toolkit/controls/unocontrols.hxx
-+++ toolkit/inc/toolkit/controls/unocontrols.hxx
-@@ -219,10 +219,11 @@ private:
+diff --git a/toolkit/inc/toolkit/controls/unocontrols.hxx b/toolkit/inc/toolkit/controls/unocontrols.hxx
+index 72c7db8..df58c56 100644
+--- a/toolkit/inc/toolkit/controls/unocontrols.hxx
++++ b/toolkit/inc/toolkit/controls/unocontrols.hxx
+@@ -54,6 +54,8 @@
+ #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/XGraphicLinkProvider.hpp>
++#include <com/sun/star/lang/XInitialization.hpp>
+ #include <toolkit/controls/unocontrolmodel.hxx>
+ #include <toolkit/controls/unocontrolbase.hxx>
+ #include <toolkit/helper/macros.hxx>
+@@ -67,6 +69,23 @@
+
+ #include <list>
+
++namespace css = ::com::sun::star;
++
++typedef ::cppu::WeakImplHelper2< css::graphic::XGraphicLinkProvider, css::lang::XInitialization > GRAPHIC_LINKPROVIDER_BASE;
++
++class GraphLinkProviderImpl : public GRAPHIC_LINKPROVIDER_BASE
++{
++ css::uno::Reference< css::embed::XStorage > mxStorage;
++ rtl::OUString msURL;
++public:
++ GraphLinkProviderImpl();
++ // XGraphicLinkProvider
++ virtual css::uno::Reference< css::embed::XStorage > SAL_CALL getStorage() throw (css::uno::RuntimeException);
++
++ virtual ::rtl::OUString SAL_CALL getSourceURL() throw (css::uno::RuntimeException);
++ // XInitialization
++ virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) throw (css::uno::Exception, css::uno::RuntimeException);
++};
+
+ // ----------------------------------------------------
+ // class UnoControlEditModel
+@@ -219,10 +238,10 @@ private:
std::list< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > > maListeners;
bool mbAdjustingImagePosition;
bool mbAdjustingGraphic;
-+ bool mbInLinkProvider;
-
+-
++ bool mbAdjustingLinkProvider;
protected:
- ImageProducerControlModel() : mbAdjustingImagePosition( false ), mbAdjustingGraphic( false ) { }
- ImageProducerControlModel( const ImageProducerControlModel& _rSource ) : com::sun::star::awt::XImageProducer(), UnoControlModel( _rSource ), mbAdjustingImagePosition( false ), mbAdjustingGraphic( false ) { }
+ ImageProducerControlModel();
-+ ImageProducerControlModel( const ImageProducerControlModel& _rSource ) : com::sun::star::awt::XImageProducer(), UnoControlModel( _rSource ), mbAdjustingImagePosition( false ), mbAdjustingGraphic( false ), mbInLinkProvider( false ) { }
++ ImageProducerControlModel( const ImageProducerControlModel& _rSource );
::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
-diff --git toolkit/inc/toolkit/helper/property.hxx toolkit/inc/toolkit/helper/property.hxx
+diff --git a/toolkit/inc/toolkit/helper/property.hxx b/toolkit/inc/toolkit/helper/property.hxx
index db61c94..73e861e 100644
---- toolkit/inc/toolkit/helper/property.hxx
-+++ toolkit/inc/toolkit/helper/property.hxx
+--- a/toolkit/inc/toolkit/helper/property.hxx
++++ b/toolkit/inc/toolkit/helper/property.hxx
@@ -190,6 +190,7 @@ namespace rtl {
#define BASEPROPERTY_CUSTOMUNITTEXT 136 // ::rtl::OUString
#define BASEPROPERTY_ENABLEVISIBLE 137 // sal_Bool
@@ -453,40 +261,40 @@
// Keine gebundenen Properties, werden immer aus der Property BASEPROPERTY_FONTDESCRIPTOR entnommen.
#define BASEPROPERTY_FONTDESCRIPTORPART_START 1000
-diff --git toolkit/source/controls/dialogcontrol.cxx toolkit/source/controls/dialogcontrol.cxx
-index 3fd5723..2fe56a4 100644
---- toolkit/source/controls/dialogcontrol.cxx
-+++ toolkit/source/controls/dialogcontrol.cxx
-@@ -2120,10 +2120,15 @@ throw (RuntimeException)
-
- if ( url.getLength() > 0 )
+diff --git a/toolkit/inc/toolkit/helper/servicenames.hxx b/toolkit/inc/toolkit/helper/servicenames.hxx
+index 78a507a..6404f07 100644
+--- a/toolkit/inc/toolkit/helper/servicenames.hxx
++++ b/toolkit/inc/toolkit/helper/servicenames.hxx
+@@ -98,6 +98,7 @@ extern const sal_Char __FAR_DATA szServi
+ extern const sal_Char __FAR_DATA szServiceName_UnoSimpleAnimationControl[], szServiceName_UnoSimpleAnimationControlModel[];
+ extern const sal_Char __FAR_DATA szServiceName_UnoThrobberControl[], szServiceName_UnoThrobberControlModel[];
+ extern const sal_Char __FAR_DATA szServiceName_UnoControlFixedHyperlink[], szServiceName_UnoControlFixedHyperlinkModel[];
++extern const sal_Char __FAR_DATA szServiceName_GraphLinkProvider[];
+
+ // ExtUnoWrapper:
+ extern const char __FAR_DATA szServiceName_ImageProducer[], szServiceName2_ImageProducer[];
+diff --git a/toolkit/source/controls/dialogcontrol.cxx b/toolkit/source/controls/dialogcontrol.cxx
+index 3fd5723..a5e52a6 100644
+--- a/toolkit/source/controls/dialogcontrol.cxx
++++ b/toolkit/source/controls/dialogcontrol.cxx
+@@ -2118,7 +2118,8 @@ throw (RuntimeException)
+ rbase >>= baseLocation;
+ rUrl >>= url;
+
+- if ( url.getLength() > 0 )
++ // Don't adjust a package url
++ if ( !utl::SvPictureStreamHelper::IsPackagePictureURL( url ) && url.getLength() > 0 )
{
-- INetURLObject urlObj(baseLocation);
-- urlObj.removeSegment();
-- baseLocation = urlObj.GetMainURL( INetURLObject::NO_DECODE );
-- ::osl::FileBase::getAbsoluteFileURL( baseLocation, url, ret );
-+ if ( url.indexOf( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.Package:") ) ) == 0 )
-+ ret = url;
-+ else
-+ {
-+ INetURLObject urlObj(baseLocation);
-+ urlObj.removeSegment();
-+ baseLocation = urlObj.GetMainURL( INetURLObject::NO_DECODE );
-+ ::osl::FileBase::getAbsoluteFileURL( baseLocation, url, ret );
-+ }
- }
-
- return ret;
-diff --git toolkit/source/controls/unocontrolmodel.cxx toolkit/source/controls/unocontrolmodel.cxx
-index 6f3b633..2c107b8 100644
---- toolkit/source/controls/unocontrolmodel.cxx
-+++ toolkit/source/controls/unocontrolmodel.cxx
-@@ -36,7 +36,8 @@
- #include <com/sun/star/awt/FontWidth.hpp>
+ INetURLObject urlObj(baseLocation);
+ urlObj.removeSegment();
+diff --git a/toolkit/source/controls/unocontrolmodel.cxx b/toolkit/source/controls/unocontrolmodel.cxx
+index 6f3b633..4e24a16 100644
+--- a/toolkit/source/controls/unocontrolmodel.cxx
++++ b/toolkit/source/controls/unocontrolmodel.cxx
+@@ -37,6 +37,7 @@
#include <com/sun/star/awt/FontWeight.hpp>
#include <com/sun/star/awt/FontSlant.hpp>
--#include <com/sun/star/graphic/XGraphicProvider.hpp>
-+#include <com/sun/star/graphic/XGraphic.hpp>
+ #include <com/sun/star/graphic/XGraphicProvider.hpp>
+#include <com/sun/star/graphic/XGraphicLinkProvider.hpp>
#include <com/sun/star/io/XMarkableStream.hpp>
#include <toolkit/controls/unocontrolmodel.hxx>
@@ -500,23 +308,81 @@
case BASEPROPERTY_VERTICALALIGN:
case BASEPROPERTY_BORDERCOLOR:
case BASEPROPERTY_SYMBOL_COLOR:
-diff --git toolkit/source/controls/unocontrols.cxx toolkit/source/controls/unocontrols.cxx
-index 821c1b9..fa2aae6 100644
---- toolkit/source/controls/unocontrols.cxx
-+++ toolkit/source/controls/unocontrols.cxx
-@@ -37,6 +37,7 @@
+diff --git a/toolkit/source/controls/unocontrols.cxx b/toolkit/source/controls/unocontrols.cxx
+index 821c1b9..bbcdb82 100644
+--- a/toolkit/source/controls/unocontrols.cxx
++++ b/toolkit/source/controls/unocontrols.cxx
+@@ -37,6 +37,8 @@
#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/XGraphicLinkProvider.hpp>
++#include <com/sun/star/document/XStorageBasedDocument.hpp>
++#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/util/Date.hpp>
-@@ -548,6 +549,11 @@ UnoFileControl::UnoFileControl()
+@@ -51,6 +53,7 @@
+ #include <toolkit/helper/servicenames.hxx>
+ #include <toolkit/helper/macros.hxx>
+ #include <toolkit/helper/imagealign.hxx>
++#include <unotools/ucbstreamhelper.hxx>
+
+ // for introspection
+ #include <toolkit/awt/vclxwindows.hxx>
+@@ -58,6 +61,7 @@
+ #include <comphelper/componentcontext.hxx>
+ #include <comphelper/processfactory.hxx>
+ #include <comphelper/extract.hxx>
++
+ #include <vcl/wrkwin.hxx>
+ #include <vcl/svapp.hxx>
+ #include <vcl/edit.hxx>
+@@ -104,6 +108,34 @@ static void lcl_knitImageComponents( con
+ }
+ }
+
++
++GraphLinkProviderImpl::GraphLinkProviderImpl()
++{
++}
++
++Reference< embed::XStorage > SAL_CALL GraphLinkProviderImpl::getStorage() throw (RuntimeException)
++{
++ return mxStorage;
++}
++
++::rtl::OUString SAL_CALL GraphLinkProviderImpl::getSourceURL() throw (RuntimeException)
++{
++ return msURL;
++}
++
++void SAL_CALL GraphLinkProviderImpl::initialize( const uno::Sequence< uno::Any >& aArguments ) throw (uno::Exception, uno::RuntimeException)
++{
++ if ( aArguments.getLength() != 2 )
++ throw uno::RuntimeException();
++
++ aArguments[ 0 ] >>= msURL;
++ Reference< frame::XModel > xModel( aArguments[ 1 ], UNO_QUERY_THROW );
++
++ Reference< document::XStorageBasedDocument > xDocStorage( xModel, UNO_QUERY_THROW );
++ mxStorage.set( xDocStorage->getDocumentStorage(), UNO_QUERY_THROW );
++ // #TODO sprinkle with some asserts
++}
++
+ // ----------------------------------------------------
+ // class UnoControlEditModel
+ // ----------------------------------------------------
+@@ -548,6 +580,17 @@ UnoFileControl::UnoFileControl()
// ----------------------------------------------------
// class ImageProducerControlModel
// ----------------------------------------------------
-+ImageProducerControlModel::ImageProducerControlModel() : mbAdjustingImagePosition( false ), mbAdjustingGraphic( false )
++
++ImageProducerControlModel::ImageProducerControlModel() : mbAdjustingImagePosition( false ), mbAdjustingGraphic( false ), mbAdjustingLinkProvider( false )
++{
++ ImplRegisterProperty( BASEPROPERTY_GRAPHICLINKPROVIDER );
++}
++
++ImageProducerControlModel::ImageProducerControlModel( const ImageProducerControlModel& _rSource ) : awt::XImageProducer(), UnoControlModel( _rSource ), mbAdjustingImagePosition( false ), mbAdjustingGraphic( false ), mbAdjustingLinkProvider( false )
+{
+ ImplRegisterProperty( BASEPROPERTY_GRAPHICLINKPROVIDER );
+}
@@ -524,7 +390,7 @@
uno::Any SAL_CALL ImageProducerControlModel::queryInterface( const uno::Type & rType ) throw(uno::RuntimeException)
{
return UnoControlModel::queryInterface( rType );
-@@ -578,7 +584,7 @@ uno::Any ImageProducerControlModel::Impl
+@@ -578,7 +621,7 @@ uno::Any ImageProducerControlModel::Impl
}
namespace
{
@@ -533,11 +399,11 @@
{
uno::Reference< graphic::XGraphic > xGraphic;
if ( !_rURL.getLength() )
-@@ -593,6 +599,13 @@ namespace
+@@ -593,6 +636,13 @@ namespace
uno::Sequence< beans::PropertyValue > aMediaProperties(1);
aMediaProperties[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) );
aMediaProperties[0].Value <<= _rURL;
-+ if ( rxStorage.is() )
++ if ( rxStorage.is() && ::utl::SvPictureStreamHelper::IsPackagePictureURL( _rURL ) )
+ {
+ sal_Int32 nOldLen = aMediaProperties.getLength();
+ aMediaProperties.realloc( nOldLen + 1 );
@@ -547,7 +413,7 @@
xGraphic = xProvider->queryGraphic( aMediaProperties );
}
}
-@@ -603,6 +616,13 @@ namespace
+@@ -603,8 +653,16 @@ namespace
return xGraphic;
}
@@ -560,13 +426,16 @@
+
}
++
void SAL_CALL ImageProducerControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception)
-@@ -615,16 +635,47 @@ void SAL_CALL ImageProducerControlModel:
+ {
+ UnoControlModel::setFastPropertyValue_NoBroadcast( nHandle, rValue );
+@@ -615,17 +673,45 @@ void SAL_CALL ImageProducerControlModel:
{
switch ( nHandle )
{
-+ // someone wants to set an image that is carried in the
-+ // associated storage ( e.g the document )
++ // someone wants to set an image that is carried in the
++ // associated storage ( e.g the document )
+ case BASEPROPERTY_GRAPHICLINKPROVIDER:
+ {
+ uno::Reference< graphic::XGraphicLinkProvider > xProv;
@@ -577,68 +446,62 @@
+ sURL = xProv->getSourceURL();
+ if ( sURL.getLength() )
+ {
-+ mbInLinkProvider = true;
++ mbAdjustingLinkProvider = true;
+ setPropertyValue( GetPropertyName( BASEPROPERTY_IMAGEURL ), uno::makeAny( sURL ) );
-+ mbInLinkProvider = false;
++ mbAdjustingLinkProvider = false;
+ }
+ }
+ break;
+ }
-+
++
case BASEPROPERTY_IMAGEURL:
+ {
-+ OSL_TRACE("Setting IMAGEURL mbInLinkProvider = %s", mbInLinkProvider ? "true" : "false" );
-+ // someone has set the an ImageUrl ( e.g. Linked Image )
-+ if ( !mbInLinkProvider && ImplHasProperty( BASEPROPERTY_GRAPHICLINKPROVIDER ) )
-+ setPropertyValue( GetPropertyName( BASEPROPERTY_GRAPHICLINKPROVIDER ), uno::makeAny( uno::Reference< graphic::XGraphicLinkProvider >() ) );
-+
-+
++ if ( !mbAdjustingLinkProvider && ImplHasProperty( BASEPROPERTY_GRAPHICLINKPROVIDER ) )
++ // reset the GraphicLinkProvider ( null ) if someone is setting
++ // the external ImageURL property directly.
++ setPropertyValue( GetPropertyName( BASEPROPERTY_GRAPHICLINKPROVIDER ), uno::makeAny( uno::Reference< graphic::XGraphicLinkProvider >() ) );
if ( !mbAdjustingGraphic && ImplHasProperty( BASEPROPERTY_GRAPHIC ) )
{
mbAdjustingGraphic = true;
::rtl::OUString sImageURL;
OSL_VERIFY( rValue >>= sImageURL );
- setPropertyValue( GetPropertyName( BASEPROPERTY_GRAPHIC ), uno::makeAny( lcl_getGraphicFromURL_nothrow( sImageURL ) ) );
-+ uno::Reference< graphic::XGraphicLinkProvider > xProv;
++ uno::Reference< graphic::XGraphicLinkProvider > xProv;
+ if ( ImplHasProperty( BASEPROPERTY_GRAPHICLINKPROVIDER ) )
+ getPropertyValue( GetPropertyName( BASEPROPERTY_GRAPHICLINKPROVIDER ) ) >>= xProv;
-+ setPropertyValue( GetPropertyName( BASEPROPERTY_GRAPHIC ), uno::makeAny( lcl_getGraphicFromURL_nothrow( sImageURL , xProv.is() ? xProv->getStorage() : NULL ) ) );
++ setPropertyValue( GetPropertyName( BASEPROPERTY_GRAPHIC ), uno::makeAny( lcl_getGraphicFromURL_nothrow( sImageURL, xProv.is() ? xProv->getStorage() : NULL ) ) );
mbAdjustingGraphic = false;
}
break;
+-
+ }
-
case BASEPROPERTY_GRAPHIC:
if ( !mbAdjustingGraphic && ImplHasProperty( BASEPROPERTY_IMAGEURL ) )
-@@ -676,8 +727,23 @@ void ImageProducerControlModel::removeCo
+ {
+@@ -676,8 +762,18 @@ void ImageProducerControlModel::removeCo
void ImageProducerControlModel::startProduction( ) throw (::com::sun::star::uno::RuntimeException)
{
- uno::Sequence<uno::Any> aArgs(1);
++ uno::Sequence<uno::Any> aArgs(2);
+ aArgs.getArray()[0] = getPropertyValue( GetPropertyName( BASEPROPERTY_IMAGEURL ) );
++
+ uno::Reference< graphic::XGraphicLinkProvider > xProv;
+ if ( ImplHasProperty( BASEPROPERTY_GRAPHICLINKPROVIDER ) )
+ getPropertyValue( GetPropertyName( BASEPROPERTY_GRAPHICLINKPROVIDER ) ) >>= xProv;
-+ uno::Sequence<uno::Any> aArgs;
++
+ if ( xProv.is() )
-+ aArgs.realloc( 2 );
++ aArgs[1] <<= xProv->getStorage();
+ else
+ aArgs.realloc( 1 );
- aArgs.getArray()[0] = getPropertyValue( GetPropertyName( BASEPROPERTY_IMAGEURL ) );
-+ rtl::OUString sUrl;
-+ aArgs[0] >>= sUrl;
-+ if ( xProv.is() )
-+ {
-+
-+ aArgs[1] <<= xProv->getStorage();
-+ }
+
uno::Reference< lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
uno::Reference< awt::XImageProducer > xImageProducer( xMSF->createInstanceWithArguments( ::rtl::OUString::createFromAscii( "com.sun.star.awt.ImageProducer" ), aArgs ), uno::UNO_QUERY );
if ( xImageProducer.is() )
-diff --git toolkit/source/helper/property.cxx toolkit/source/helper/property.cxx
+diff --git a/toolkit/source/helper/property.cxx b/toolkit/source/helper/property.cxx
index a7fc25b..1186c26 100644
---- toolkit/source/helper/property.cxx
-+++ toolkit/source/helper/property.cxx
+--- a/toolkit/source/helper/property.cxx
++++ b/toolkit/source/helper/property.cxx
@@ -53,6 +53,7 @@
#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
#include <com/sun/star/beans/PropertyAttribute.hpp>
@@ -655,112 +518,109 @@
DECL_PROP_2 ( "HelpText", HELPTEXT, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
DECL_PROP_2 ( "HelpURL", HELPURL, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
DECL_PROP_2 ( "HideInactiveSelection", HIDEINACTIVESELECTION, bool, BOUND, MAYBEDEFAULT ),
-diff --git xmloff/source/forms/elementimport.cxx xmloff/source/forms/elementimport.cxx
-index edc0c77..0cc56a7 100644
---- xmloff/source/forms/elementimport.cxx
-+++ xmloff/source/forms/elementimport.cxx
-@@ -56,6 +56,7 @@
- #include <com/sun/star/beans/XMultiPropertySet.hpp>
- #include <com/sun/star/beans/XPropertyContainer.hpp>
- #include <com/sun/star/beans/PropertyAttribute.hpp>
-+#include <com/sun/star/document/XStorageBasedDocument.hpp>
+diff --git a/toolkit/source/helper/registerservices.cxx b/toolkit/source/helper/registerservices.cxx
+index 9898393..ab5c14f 100644
+--- a/toolkit/source/helper/registerservices.cxx
++++ b/toolkit/source/helper/registerservices.cxx
+@@ -198,6 +198,7 @@ IMPL_CREATEINSTANCE( UnoSimpleAnimationC
+ IMPL_CREATEINSTANCE( UnoSimpleAnimationControlModel )
+ IMPL_CREATEINSTANCE( UnoThrobberControl )
+ IMPL_CREATEINSTANCE( UnoThrobberControlModel )
++IMPL_CREATEINSTANCE( GraphLinkProviderImpl )
+
+ extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL TreeControl_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
+ extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL TreeControlModel_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
+@@ -287,6 +288,7 @@ TOOLKIT_DLLPUBLIC sal_Bool SAL_CALL comp
+ registerServices( xRegistryKey, "UnoThrobberControl", szServiceName_UnoThrobberControl );
+ registerServices( xRegistryKey, "UnoFixedHyperlinkControl", szServiceName_UnoControlFixedHyperlink );
+ registerServices( xRegistryKey, "UnoControlFixedHyperlinkModel", szServiceName_UnoControlFixedHyperlinkModel );
++ registerServices( xRegistryKey, "GraphLinkProviderImpl", szServiceName_GraphLinkProvider );
+
+ comp_AsyncCallback_component_writeInfo( _pServiceManager, _pRegistryKey );
+ comp_Layout_component_writeInfo( _pServiceManager, _pRegistryKey );
+@@ -369,6 +371,7 @@ TOOLKIT_DLLPUBLIC void* SAL_CALL compone
+ CHECKANDCREATEFACTORY( UnoThrobberControl, szServiceName_UnoThrobberControl, NULL )
+ CHECKANDCREATEFACTORY( UnoFixedHyperlinkControl, szServiceName_UnoControlFixedHyperlink, NULL )
+ CHECKANDCREATEFACTORY( UnoControlFixedHyperlinkModel, szServiceName_UnoControlFixedHyperlinkModel, NULL )
++ CHECKANDCREATEFACTORY( GraphLinkProviderImpl, szServiceName_GraphLinkProvider, NULL )
+
+ if ( rtl_str_compare( sImplementationName, "com.sun.star.awt.comp.AsyncCallback" ) == 0 )
+ return comp_AsyncCallback_component_getFactory( sImplementationName, _pServiceManager, _pRegistryKey );
+diff --git a/toolkit/source/helper/servicenames.cxx b/toolkit/source/helper/servicenames.cxx
+index 3b27e91..2b65c99 100644
+--- a/toolkit/source/helper/servicenames.cxx
++++ b/toolkit/source/helper/servicenames.cxx
+@@ -101,4 +101,4 @@ const sal_Char __FAR_DATA szServiceName_
+ const sal_Char __FAR_DATA szServiceName_UnoThrobberControl[] = "com.sun.star.awt.UnoThrobberControl";
+ const sal_Char __FAR_DATA szServiceName_UnoControlFixedHyperlink[] = "com.sun.star.awt.UnoControlFixedHyperlink";
+ const sal_Char __FAR_DATA szServiceName_UnoControlFixedHyperlinkModel[] = "com.sun.star.awt.UnoControlFixedHyperlinkModel";
+-
++const sal_Char __FAR_DATA szServiceName_GraphLinkProvider[] = "com.sun.star.awt.GraphicLinkProvider";
+diff --git a/xmloff/source/forms/elementimport.cxx b/xmloff/source/forms/elementimport.cxx
+index edc0c77..698688c 100644
+--- a/xmloff/source/forms/elementimport.cxx
++++ b/xmloff/source/forms/elementimport.cxx
+@@ -47,6 +47,7 @@
+ #include "gridcolumnproptranslator.hxx"
+ #include <comphelper/extract.hxx>
+ #include <comphelper/types.hxx>
++#include <unotools/ucbstreamhelper.hxx>
+
+ /** === begin UNO includes === **/
+ #include <com/sun/star/text/XText.hpp>
+@@ -59,7 +60,7 @@
/** === end UNO includes === **/
#include <tools/urlobj.hxx>
#include <tools/time.hxx>
-@@ -81,6 +82,38 @@ namespace xmloff
- using namespace ::com::sun::star::util;
- using namespace ::com::sun::star::text;
- using namespace ::comphelper;
-+typedef ::cppu::WeakImplHelper1< graphic::XGraphicLinkProvider > GRAPHIC_LINKPROVIDER_BASE;
-+
-+class GraphLinkProviderImpl : public GRAPHIC_LINKPROVIDER_BASE
-+{
-+ Reference< embed::XStorage > mxStorage;
-+ rtl::OUString msURL;
-+public:
-+ GraphLinkProviderImpl( const Reference< frame::XModel >& rxModel, const rtl::OUString& sURL ) : msURL( sURL )
-+ {
-+ Reference< document::XStorageBasedDocument > xDocStorage( rxModel, UNO_QUERY );
-+ if ( xDocStorage.is() )
-+ {
-+ mxStorage = xDocStorage->getDocumentStorage();
-+ }
-+ }
-+
-+ virtual Reference< embed::XStorage > SAL_CALL getStorage() throw (RuntimeException)
-+ {
-+ return mxStorage;
-+ }
-+
-+ virtual void SAL_CALL setStorage( const Reference< embed::XStorage >& _storage ) throw (RuntimeException)
-+ {
-+ }
-+
-+ virtual ::rtl::OUString SAL_CALL getSourceURL() throw (RuntimeException)
-+ {
-+ return msURL;
-+ }
-+
-+};
-+
+-
++#include <comphelper/storagehelper.hxx>
+ #include <algorithm>
+ #include <functional>
- #define PROPID_VALUE 1
- #define PROPID_CURRENT_VALUE 2
-@@ -979,10 +1012,39 @@ namespace xmloff
+@@ -979,6 +980,13 @@ namespace xmloff
_rValue, OEnumMapper::getEnumMap( OEnumMapper::epImageAlign )
) >>= m_nImageAlign );
}
-+ else if ( _rLocalName == GetXMLToken( XML_IMAGE_DATA ) )//&& ( _rValue.indexOf( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.Package:") ) ) == 0 ) )
-+ {
-+ // strange, it seems the .GetAbsoluteReference call changes
-+ // vnd.sun.star.Package to vnd.sun.star.package
-+ sal_Int32 index = _rValue.toAsciiLowerCase().indexOf( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.package:") ) );
-+ OSL_TRACE("*** Setting Packeurl link provider thing _rValue is %s index of = %d", rtl::OUStringToOString( _rValue, RTL_TEXTENCODING_UTF8 ).getStr(), index );
-+ if ( index == 0 )
-+ m_xProv = new GraphLinkProviderImpl( m_rContext.getGlobalContext().GetModel(), _rValue );
-+ else
-+ OControlImport::handleAttribute( _nNamespaceKey, _rLocalName, _rValue );
-+ }
++ else if ( _rLocalName == GetXMLToken( XML_IMAGE_DATA ) && ::utl::SvPictureStreamHelper::IsPackagePictureURL( _rValue ) )
++ {
++ uno::Sequence< uno::Any > aArgs( 2 );
++ aArgs[ 0 ] = uno::makeAny( _rValue );
++ aArgs[ 1 ] = uno::makeAny( m_rContext.getGlobalContext().GetModel() );
++ m_xProv.set( m_rContext.getGlobalContext().getServiceFactory()->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.GraphicLinkProvider" ) ), aArgs ), uno::UNO_QUERY );
++ }
else
OControlImport::handleAttribute( _nNamespaceKey, _rLocalName, _rValue );
}
--
-+ void OImagePositionImport::EndElement()
-+ {
-+ OSL_TRACE("** Image::EndElement");
-+ if ( m_xElement.is () )
-+ {
-+ OSL_TRACE("**** About to set the attribute xProv is %d", m_xProv.is() );
-+ try
-+ {
-+ m_xElement->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("GraphicLinkProvider" ) ), uno::makeAny( m_xProv ) );
-+ }
-+ catch(uno::Exception& e)
-+ {
-+ OSL_TRACE("Caught exception %s", rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ }
-+ }
-+ else
-+ OSL_TRACE("Phreaking null");
-+ OControlImport::EndElement();
-+ }
- //---------------------------------------------------------------------
- void OImagePositionImport::StartElement(const Reference< sax::XAttributeList >& _rxAttrList)
- {
-@@ -1136,7 +1198,9 @@ namespace xmloff
- if ( bMakeAbsolute )
- {
- // make a global URL out of the local one
-+ OSL_TRACE("Incomming URL = %s", rtl::OUStringToOString( _rValue, RTL_TEXTENCODING_UTF8 ).getStr() );
- ::rtl::OUString sAdjustedValue = m_rContext.getGlobalContext().GetAbsoluteReference( _rValue );
-+ OSL_TRACE("OutGoing URL = %s", rtl::OUStringToOString( sAdjustedValue, RTL_TEXTENCODING_UTF8 ).getStr() );
- OImagePositionImport::handleAttribute( _nNamespaceKey, _rLocalName, sAdjustedValue );
- }
- else
-diff --git xmloff/source/forms/elementimport.hxx xmloff/source/forms/elementimport.hxx
-index 58d279a..a41d341 100644
---- xmloff/source/forms/elementimport.hxx
-+++ xmloff/source/forms/elementimport.hxx
+@@ -1004,6 +1012,25 @@ namespace xmloff
+ implPushBackPropertyValue( aImagePosition );
+ }
+ }
++ void OImagePositionImport::EndElement()
++ {
++ OSL_TRACE("** Image::EndElement");
++ if ( m_xElement.is () )
++ {
++ OSL_TRACE("**** About to set the attribute xProv is %d", m_xProv.is() );
++ try
++ {
++ m_xElement->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("GraphicLinkProvider" ) ), uno::makeAny( m_xProv ) );
++ }
++ catch(uno::Exception& e)
++ {
++ OSL_TRACE("Caught exception %s", rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr() );
++ }
++ }
++ else
++ OSL_TRACE("Phreaking null");
++ OControlImport::EndElement();
++ }
+
+ //=====================================================================
+ //= OReferredControlImport
+diff --git a/xmloff/source/forms/elementimport.hxx b/xmloff/source/forms/elementimport.hxx
+index 58d279a..57e69b0 100644
+--- a/xmloff/source/forms/elementimport.hxx
++++ b/xmloff/source/forms/elementimport.hxx
@@ -41,6 +41,7 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/form/XGridColumnFactory.hpp>
@@ -769,15 +629,16 @@
/** === end UNO includes === **/
#include <comphelper/stl_types.hxx>
#include "eventimport.hxx"
-@@ -282,6 +283,7 @@ namespace xmloff
+@@ -282,7 +283,7 @@ namespace xmloff
sal_Int16 m_nImagePosition;
sal_Int16 m_nImageAlign;
sal_Bool m_bHaveImagePosition;
+-
+ ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphicLinkProvider > m_xProv;
-
public:
OImagePositionImport(
-@@ -294,7 +296,7 @@ namespace xmloff
+ IFormsImportContext& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+@@ -294,7 +295,7 @@ namespace xmloff
// SvXMLImportContext overridables
virtual void StartElement(
const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList);
@@ -786,134 +647,257 @@
// OPropertyImport overridables
virtual void handleAttribute( sal_uInt16 _nNamespaceKey,
const ::rtl::OUString& _rLocalName,
-diff --git xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
-index d57bb95..f495e5f 100644
---- xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
-+++ xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
-@@ -40,6 +40,8 @@
- #include <com/sun/star/beans/NamedValue.hpp>
- #include <com/sun/star/table/CellAddress.hpp>
- #include <com/sun/star/table/CellRangeAddress.hpp>
-+#include <com/sun/star/graphic/XGraphicLinkProvider.hpp>
-+#include <com/sun/star/document/XStorageBasedDocument.hpp>
+diff --git a/unotools/inc/unotools/streamhelper.hxx b/unotools/inc/unotools/streamhelper.hxx
+index 375d8b3..77704d5 100644
+--- a/unotools/inc/unotools/streamhelper.hxx
++++ b/unotools/inc/unotools/streamhelper.hxx
+@@ -111,7 +111,6 @@ public:
+ virtual void SAL_CALL flush( ) throw(stario::NotConnectedException, stario::BufferSizeExceededException, stario::IOException, staruno::RuntimeException);
+ virtual void SAL_CALL closeOutput( ) throw(stario::NotConnectedException, stario::BufferSizeExceededException, stario::IOException, staruno::RuntimeException);
+ };
+-
+ } // namespace utl
- using namespace ::com::sun::star;
-@@ -48,6 +50,39 @@ using ::rtl::OUString;
+diff --git a/unotools/inc/unotools/ucbstreamhelper.hxx b/unotools/inc/unotools/ucbstreamhelper.hxx
+index c33855b..16f646b 100644
+--- a/unotools/inc/unotools/ucbstreamhelper.hxx
++++ b/unotools/inc/unotools/ucbstreamhelper.hxx
+@@ -33,6 +33,7 @@
+ #include <com/sun/star/uno/Reference.hxx>
+ #include <com/sun/star/io/XInputStream.hpp>
+ #include <com/sun/star/io/XStream.hpp>
++#include <com/sun/star/embed/XStorage.hpp>
+ #include "unotools/unotoolsdllapi.h"
- namespace xmlscript
+ #include <tools/stream.hxx>
+@@ -81,6 +82,15 @@ namespace utl
+ static SvStream* CreateStream( NS_UNO::Reference < NS_IO::XInputStream > xStream, sal_Bool bCloseStream );
+ static SvStream* CreateStream( NS_UNO::Reference < NS_IO::XStream > xStream, sal_Bool bCloseStream );
+ };
++
++class UNOTOOLS_DLLPUBLIC SvPictureStreamHelper
++{
++ public:
++ // Probably these functions are probably in the wrong place, but first
++ // lets just kill the cut'n'paste rot, where is SvStream defined, svtools? maybe there then
++ static bool IsPackagePictureURL( const rtl::OUString& rURL );
++ static SvStream* GetStreamFromPackagePictureURL( const rtl::OUString& rURL, const NS_UNO::Reference< ::com::sun::star::embed::XStorage >& rxRoot )throw ( NS_UNO::Exception );
++};
+ }
+
+ #endif
+diff --git a/unotools/source/ucbhelper/ucbstreamhelper.cxx b/unotools/source/ucbhelper/ucbstreamhelper.cxx
+index f9e56ba..3624c9e 100644
+--- a/unotools/source/ucbhelper/ucbstreamhelper.cxx
++++ b/unotools/source/ucbhelper/ucbstreamhelper.cxx
+@@ -41,6 +41,7 @@
+ #endif
+ #include <com/sun/star/ucb/InsertCommandArgument.hpp>
+ #include <com/sun/star/io/XActiveDataStreamer.hpp>
++#include <com/sun/star/embed/ElementModes.hpp>
+
+ #include <ucbhelper/contentbroker.hxx>
+ #include <ucbhelper/content.hxx>
+@@ -54,6 +55,7 @@ using namespace ::com::sun::star::ucb;
+ using namespace ::com::sun::star::task;
+ using namespace ::com::sun::star::lang;
+ using namespace ::com::sun::star::beans;
++using namespace ::com::sun::star::embed;
+
+ namespace utl
{
+@@ -248,4 +250,38 @@ SvStream* UcbStreamHelper::CreateStream(
+ return pStream;
+ };
+
++SvStream* SvPictureStreamHelper::GetStreamFromPackagePictureURL( const rtl::OUString& rURL, const Reference< XStorage >& rxRoot ) throw ( Exception )
++{
++ SvStream* pIs = NULL;
++ if( rURL.getLength() )
++ {
++ sal_Int32 nIndex = 0;
++ const rtl::OUString aPicturePath( rURL.getToken( 1, ':', nIndex ) );
++ nIndex = 0;
++ const rtl::OUString aPictureStorageName( aPicturePath.getToken( 0, '/', nIndex ) );
++ const rtl::OUString aPictureStreamName( aPicturePath.getToken( 0, '/', nIndex ) );
+
-+typedef ::cppu::WeakImplHelper1< graphic::XGraphicLinkProvider > GRAPHIC_LINKPROVIDER_BASE;
++ if ( aPictureStreamName.getLength() && aPictureStorageName.getLength() )
++ {
++ if ( rxRoot->isStorageElement( aPictureStorageName ) )
++ {
++ Reference< XStorage > xPictureStorage =
++ rxRoot->openStorageElement( aPictureStorageName, ElementModes::READ );
++ if( xPictureStorage.is() && xPictureStorage->isStreamElement( aPictureStreamName ) )
++ {
++ Reference< XStream > xStream = xPictureStorage->openStreamElement( aPictureStreamName, ElementModes::READ );
++ if ( xStream.is() )
++ pIs = UcbStreamHelper::CreateStream( xStream );
++ }
++ }
++ }
++ }
++ return pIs;
++}
+
-+class GraphLinkProviderImpl : public GRAPHIC_LINKPROVIDER_BASE
++bool SvPictureStreamHelper::IsPackagePictureURL( const rtl::OUString& rURL )
+{
-+ Reference< embed::XStorage > mxStorage;
-+ rtl::OUString msURL;
-+public:
-+ GraphLinkProviderImpl( const Reference< frame::XModel >& rxModel, rtl::OUString& sURL ) : msURL( sURL )
-+ {
-+ Reference< document::XStorageBasedDocument > xDocStorage( rxModel, UNO_QUERY );
-+ if ( xDocStorage.is() )
++ return rURL.toAsciiLowerCase().indexOf( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.package:") ) ) == 0;
++}
++
+ }
+diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx
+index e8ef25c..4653eb8 100644
+--- a/extensions/source/propctrlr/formcomponenthandler.cxx
++++ b/extensions/source/propctrlr/formcomponenthandler.cxx
+@@ -1360,10 +1360,20 @@ namespace pcr
+ break;
+
+ case PROPERTY_ID_IMAGE_URL:
+- if ( impl_browseForImage_nothrow( _rData, aGuard ) )
+- eResult = InteractiveSelectionResult_ObtainedValue;
+ {
-+ mxStorage = xDocStorage->getDocumentStorage();
++ bool bIsLink = false;
++ if ( impl_browseForImage_nothrow( _rData, bIsLink, aGuard ) )
++ {
++ if ( bIsLink )
++ eResult = InteractiveSelectionResult_ObtainedValue;
++ else
++ {
++ if ( impl_handleNonImageLink_nothrow( _rData ) )
++ eResult = InteractiveSelectionResult_Success;
++ }
++ }
+ break;
+-
+ }
-+ }
-+
-+ virtual Reference< embed::XStorage > SAL_CALL getStorage() throw (RuntimeException)
-+ {
-+ return mxStorage;
-+ }
-+
-+ virtual void SAL_CALL setStorage( const Reference< embed::XStorage >& _storage ) throw (RuntimeException)
-+ {
-+ }
-+
-+ virtual ::rtl::OUString SAL_CALL getSourceURL() throw (RuntimeException)
-+ {
-+ return msURL;
-+ }
-+
-+};
-+
- void importBindableAndListRangeBits( DialogImport* _pImport, const rtl::OUString sLinkedCell, const rtl::OUString & sCellRange, ControlImportContext& ctx )
- {
- Reference< lang::XMultiServiceFactory > xFac( _pImport->getDocOwner(), UNO_QUERY );;
-@@ -1059,9 +1094,27 @@ void ImageControlElement::endElement()
- ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ScaleImage") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM("scale-image") ),
- _xAttributes );
-- ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
-+
-+ rtl::OUString sURL = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "src" ) );
-+ // hard code-test
-+ if ( sURL.indexOf( OUSTR("vnd.sun.star.Package:") ) == 0 && _pImport->getDocOwner().is() )
+ case PROPERTY_ID_TARGET_URL:
+ if ( impl_browseForTargetURL_nothrow( _rData, aGuard ) )
+ eResult = InteractiveSelectionResult_ObtainedValue;
+@@ -2656,14 +2666,31 @@ namespace pcr
+ }
+
+ //------------------------------------------------------------------------
+- bool FormComponentPropertyHandler::impl_browseForImage_nothrow( Any& _out_rNewValue, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const
++ bool FormComponentPropertyHandler::impl_browseForImage_nothrow( Any& _out_rNewValue, bool& bIsLink, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const
+ {
++ bIsLink = false; // default
+ ::rtl::OUString aStrTrans = m_pInfoService->getPropertyTranslation( PROPERTY_ID_IMAGE_URL );
+
+ ::sfx2::FileDialogHelper aFileDlg(SFXWB_GRAPHIC);
+
+ aFileDlg.SetTitle(aStrTrans);
+-
++ sal_Bool bHandleNonLink = sal_False;
++ Reference< XModel > xDocument( impl_getContextDocument_nothrow() );
++ if ( xDocument.is() )
+ {
++ bHandleNonLink = sal_True; // in the ideal world this should be enough
++ // Bit of a hack to allow basic dialog to override support for
++ // non-linked images ( e.g. those located in the document
++ // stream ) However, the toolkit control CAN handle this but
++ // the dialog code. Well, can't ( right now ) hopefully it
++ // will soon
+ try
-+ {
-+ Reference< beans::XPropertySet > xProps( ctx.getControlModel(), UNO_QUERY_THROW );
-+ Reference< graphic::XGraphicLinkProvider > xProvider ( new GraphLinkProviderImpl( _pImport->getDocOwner(), sURL ) );
-+ xProps->setPropertyValue( OUSTR("GraphicLinkProvider"), makeAny( xProvider ) );
++ { m_aContext.getContextValueByAsciiName( "SupportNonLinkedImage" ) >>= bHandleNonLink;
+ }
-+ catch( Exception& e )
++ catch( Exception& e ) // #TODO add that debug utils thing for uncaught exceptions
+ {
+ }
-+
++ }
+ Reference< XFilePickerControlAccess > xController(aFileDlg.GetFilePicker(), UNO_QUERY);
+ DBG_ASSERT(xController.is(), "FormComponentPropertyHandler::impl_browseForImage_nothrow: missing the controller interface on the file picker!");
+ if (xController.is())
+@@ -2672,8 +2699,8 @@ namespace pcr
+ xController->setValue(ExtendedFilePickerElementIds::CHECKBOX_PREVIEW, 0, ::cppu::bool2any(sal_True));
+
+ // "as link" is checked, but disabled
+- xController->setValue(ExtendedFilePickerElementIds::CHECKBOX_LINK, 0, ::cppu::bool2any(sal_True));
+- xController->enableControl(ExtendedFilePickerElementIds::CHECKBOX_LINK, sal_False);
++ xController->setValue(ExtendedFilePickerElementIds::CHECKBOX_LINK, 0, ::cppu::bool2any(!bHandleNonLink));
++ xController->enableControl(ExtendedFilePickerElementIds::CHECKBOX_LINK, bHandleNonLink );
+ }
+
+ ::rtl::OUString sCurValue;
+@@ -2687,7 +2714,13 @@ namespace pcr
+ _rClearBeforeDialog.clear();
+ bool bSuccess = ( 0 == aFileDlg.Execute() );
+ if ( bSuccess )
++ {
++ if ( bHandleNonLink && xController.is() )
++ {
++ xController->getValue(ExtendedFilePickerElementIds::CHECKBOX_LINK, 0) >>= bIsLink;
++ }
+ _out_rNewValue <<= (::rtl::OUString)aFileDlg.GetPath();
+ }
-+ else
-+ ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM("src") ),
- _xAttributes );
-+
- ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
- _xAttributes );
---- /dev/null 2008-04-22 00:28:44.000000000 +0100
-+++ offapi/com/sun/star/graphic/XGraphicLinkProvider.idl 2008-07-04 15:16:15.000000000 +0100
-@@ -0,0 +1,46 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: XGraphicProvider.idl,v $
-+ * $Revision: 1.5 $
-+ *
-+ * This file is part of OpenOffice.org.
-+ *
-+ * OpenOffice.org is free software: you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License version 3
-+ * only, as published by the Free Software Foundation.
-+ *
-+ * OpenOffice.org is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU Lesser General Public License version 3 for more details
-+ * (a copy is included in the LICENSE file that accompanied this code).
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * version 3 along with OpenOffice.org. If not, see
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#ifndef com_sun_star_graphic_XGraphicLinkProvider_idl
-+#define com_sun_star_graphic_XGraphicLinkProvider_idl
-+
-+#include <com/sun/star/uno/XInterface.idl>
-+#include <com/sun/star/embed/XStorage.idl>
+ return bSuccess;
+ }
+
+@@ -3174,6 +3207,31 @@ namespace pcr
+ }
+ return sURL;
+ }
+
-+module com { module sun { module star { module graphic
-+{
-+interface XGraphicLinkProvider : ::com::sun::star::uno::XInterface
-+{
-+ [attribute] com::sun::star::embed::XStorage Storage;
-+ [readonly, attribute] string SourceURL;
-+} ; } ; } ; } ;
-+};
++ bool FormComponentPropertyHandler::impl_handleNonImageLink_nothrow( const Any& aURL )
++ {
++ Reference< XMultiComponentFactory > xMcf = m_aContext.getUNOContext()->getServiceManager();
+
-+#endif
++ Sequence< Any > aArgs(2);
++ aArgs[ 0 ] = aURL;
++ aArgs[ 1 ] <<= impl_getContextDocument_nothrow();
++
++ Reference< XInterface > xLinkProvider = xMcf->createInstanceWithArgumentsAndContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.GraphicLinkProvider" ) ), aArgs, m_aContext.getUNOContext() );
++ bool bRes = false;
++ if ( xLinkProvider.is() )
++ {
++ try
++ {
++ m_xComponent->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "GraphicLinkProvider" ) ), makeAny( xLinkProvider ) );
++ bRes = true;
++ }
++ catch( const Exception& )
++ {
++ DBG_UNHANDLED_EXCEPTION();
++ }
++ }
++ return bRes;
++ }
+ // -------------------------------------------------------------------------
+ ::cppu::IPropertyArrayHelper* FormComponentPropertyHandler::createArrayHelper( ) const
+ {
+diff --git a/extensions/source/propctrlr/formcomponenthandler.hxx b/extensions/source/propctrlr/formcomponenthandler.hxx
+index 2216704..e7b4d76 100644
+--- a/extensions/source/propctrlr/formcomponenthandler.hxx
++++ b/extensions/source/propctrlr/formcomponenthandler.hxx
+@@ -309,7 +309,7 @@ namespace pcr
+ <TRUE/> if and only if a new image URL has been chosen by the user.
+ In this case, ->_out_rNewValue is filled with the new property value
+ */
+- bool impl_browseForImage_nothrow( ::com::sun::star::uno::Any& _out_rNewValue, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const;
++ bool impl_browseForImage_nothrow( ::com::sun::star::uno::Any& _out_rNewValue, bool& bIsLink, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const;
+
+ /** executes a dialog which allows the user to change the TargetURL property of
+ our component
+@@ -438,6 +438,8 @@ namespace pcr
+ */
+ ::rtl::OUString impl_getDocumentURL_nothrow() const;
+
++ bool impl_handleNonImageLink_nothrow( const ::com::sun::star::uno::Any& aURL );
++
+ private:
+ DECL_LINK( OnDesignerClosed, void* );
+
+diff --git a/basctl/source/dlged/propbrw.cxx b/basctl/source/dlged/propbrw.cxx
+index bfc59b0..9df7945 100644
+--- a/basctl/source/dlged/propbrw.cxx
++++ b/basctl/source/dlged/propbrw.cxx
+@@ -209,7 +209,8 @@ void PropBrw::ImplReCreateController()
+ ::cppu::ContextEntry_Init aHandlerContextInfo[] =
+ {
+ ::cppu::ContextEntry_Init( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DialogParentWindow" ) ), makeAny( VCLUnoHelper::GetInterface ( this ) ) ),
+- ::cppu::ContextEntry_Init( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ContextDocument" ) ), makeAny( m_xContextDocument ) )
++ ::cppu::ContextEntry_Init( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ContextDocument" ) ), makeAny( m_xContextDocument ) ),
++ ::cppu::ContextEntry_Init( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SupportNonLinkedImage" ) ), makeAny( sal_False ) )
+ };
+ Reference< XComponentContext > xInspectorContext(
+ ::cppu::createComponentContext( aHandlerContextInfo, sizeof( aHandlerContextInfo ) / sizeof( aHandlerContextInfo[0] ),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]