ooo-build r13163 - in trunk: . patches/dev300
- From: noelpwer svn gnome org
- To: svn-commits-list gnome org
- Subject: ooo-build r13163 - in trunk: . patches/dev300
- Date: Fri, 11 Jul 2008 16:49:32 +0000 (UTC)
Author: noelpwer
Date: Fri Jul 11 16:49:32 2008
New Revision: 13163
URL: http://svn.gnome.org/viewvc/ooo-build?rev=13163&view=rev
Log:
2008-07-11 Noel Power <noel power novell com>
* patches/dev300/apply:
* patches/dev300/controls-with-images-in-document.diff: partial fix for
i#38215 ( also needs mso filter love to hook that in too )
Added:
trunk/patches/dev300/controls-with-images-in-document.diff
Modified:
trunk/ChangeLog
trunk/patches/dev300/apply
Modified: trunk/patches/dev300/apply
==============================================================================
--- trunk/patches/dev300/apply (original)
+++ trunk/patches/dev300/apply Fri Jul 11 16:49:32 2008
@@ -1536,7 +1536,7 @@
#make properties available for non class modules
#also allow paramaters to be supported for Get properties
vba-support-properties-inmodules.diff
-
+controls-with-images-in-document.diff, i#38215, noelpwer
# FIXME: disabled now (mmeeks) - needs porting to m22.
[ VBAObjects < dev300-m22 >= beb300-m1 ]
Added: trunk/patches/dev300/controls-with-images-in-document.diff
==============================================================================
--- (empty file)
+++ trunk/patches/dev300/controls-with-images-in-document.diff Fri Jul 11 16:49:32 2008
@@ -0,0 +1,412 @@
+diff --git basctl/source/dlged/propbrw.cxx basctl/source/dlged/propbrw.cxx
+index bfc59b0..0e40383 100644
+--- basctl/source/dlged/propbrw.cxx
++++ basctl/source/dlged/propbrw.cxx
+@@ -209,7 +209,12 @@ 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 ) ),
++ // Temporary disable of non-linked images for dialogs
++ // (needs some support in the dialog code, the toolkit
++ // already supports non-linked images )
++ ::cppu::ContextEntry_Init( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SupportNonLinkedImage" ) ), makeAny( sal_False ) )
++
+ };
+ 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
+--- 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>
+
+@@ -1360,9 +1361,18 @@ namespace pcr
+ break;
+
+ case PROPERTY_ID_IMAGE_URL:
+- if ( impl_browseForImage_nothrow( _rData, aGuard ) )
+- eResult = InteractiveSelectionResult_ObtainedValue;
++ {
++ bool bIsLink = false;
++ if ( impl_browseForImage_nothrow( _rData, bIsLink, aGuard ) )
++ {
++ if ( bIsLink )
++ eResult = InteractiveSelectionResult_ObtainedValue;
++ else
++ // ImageURL already set in impl_browseForImage_nothrow
++ eResult = InteractiveSelectionResult_Success;
++ }
+ break;
++ }
+
+ case PROPERTY_ID_TARGET_URL:
+ if ( impl_browseForTargetURL_nothrow( _rData, aGuard ) )
+@@ -2656,13 +2666,27 @@ 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 = true;// reflect the legacy behavior
+ ::rtl::OUString aStrTrans = m_pInfoService->getPropertyTranslation( PROPERTY_ID_IMAGE_URL );
+
+ ::sfx2::FileDialogHelper aFileDlg(SFXWB_GRAPHIC);
+
+ aFileDlg.SetTitle(aStrTrans);
++ bool bHandleNonLink = sal_True;
++ // Bit of a hack to allow basic dialogs to override support for
++ // non-linked images ( e.g. those located in the document
++ // stream ) Event though the toolkit control CAN handle this but
++ // the dialog code can't ( right now ) hopefully it will soon
++ try
++ {
++ m_aContext.getContextValueByAsciiName( "SupportNonLinkedImage" ) >>= bHandleNonLink;
++ }
++ catch( const Exception& e )
++ {
++ DBG_UNHANDLED_EXCEPTION(); // shouldn't happen
++ }
+
+ Reference< XFilePickerControlAccess > xController(aFileDlg.GetFilePicker(), UNO_QUERY);
+ DBG_ASSERT(xController.is(), "FormComponentPropertyHandler::impl_browseForImage_nothrow: missing the controller interface on the file picker!");
+@@ -2671,9 +2695,9 @@ namespace pcr
+ // do a preview by default
+ 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(bIsLink));
++ xController->enableControl(ExtendedFilePickerElementIds::CHECKBOX_LINK, bHandleNonLink );
++
+ }
+
+ ::rtl::OUString sCurValue;
+@@ -2687,7 +2711,29 @@ namespace pcr
+ _rClearBeforeDialog.clear();
+ bool bSuccess = ( 0 == aFileDlg.Execute() );
+ if ( bSuccess )
++ {
++ if ( bHandleNonLink && xController.is() )
++ {
++ xController->getValue(ExtendedFilePickerElementIds::CHECKBOX_LINK, 0) >>= bIsLink;
++ }
++ if ( !bIsLink )
++ {
++ 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 );
++ rtl::OUString ObjectID( RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.GraphicObject:" ) );
++ String id( foo.GetUniqueID().GetBuffer(), RTL_TEXTENCODING_ASCII_US );
++
++ ObjectID = ObjectID + id;;
++
++ m_xComponent->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ImageURL" ) ), uno::makeAny( ObjectID ) );
++ }
++
+ _out_rNewValue <<= (::rtl::OUString)aFileDlg.GetPath();
++ }
+ return bSuccess;
+ }
+
+diff --git extensions/source/propctrlr/formcomponenthandler.hxx extensions/source/propctrlr/formcomponenthandler.hxx
+index 2216704..fb34827 100644
+--- extensions/source/propctrlr/formcomponenthandler.hxx
++++ extensions/source/propctrlr/formcomponenthandler.hxx
+@@ -305,11 +305,13 @@ namespace pcr
+ our component actually has a ImageURL property
+ @param _out_rNewValue
+ the new property value, if the user chose a new image url
++ @param _out_bIsLink
++ <TRUE/> if the chosen image a link
+ @return
+ <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& _out_bIsLink, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const;
+
+ /** 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
++++ extensions/source/propctrlr/propcontroller.cxx
+@@ -1481,7 +1481,8 @@ namespace pcr
+ {
+ ::cppu::ContextEntry_Init aHandlerContextInfo[] =
+ {
+- ::cppu::ContextEntry_Init( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DialogParentWindow" ) ), makeAny( VCLUnoHelper::GetInterface( m_pView ) ) )
++ ::cppu::ContextEntry_Init( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DialogParentWindow" ) ), makeAny( VCLUnoHelper::GetInterface( m_pView ) ) ),
++ ::cppu::ContextEntry_Init( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SupportNonLinkedImage" ) ), makeAny( sal_True ) )
+ };
+ xHandlerContext = ::cppu::createComponentContext(
+ aHandlerContextInfo, sizeof( aHandlerContextInfo ) / sizeof( aHandlerContextInfo[0] ),
+diff --git forms/source/component/ImageControl.cxx forms/source/component/ImageControl.cxx
+index 1ba9f90..5d9e757 100644
+--- forms/source/component/ImageControl.cxx
++++ forms/source/component/ImageControl.cxx
+@@ -353,7 +353,7 @@ sal_Bool OImageControlModel::handleNewIm
+ ::std::auto_ptr< SvStream > pImageStream;
+ Reference< XInputStream > xImageStream;
+
+- if ( ::svt::ImageResourceAccess::isImageResourceURL( _rURL ) )
++ if ( ::svt::ImageResourceAccess::isImageResourceURL( _rURL ) || _rURL.indexOf( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.GraphicObject:" ) ) == 0 ))
+ {
+ xImageStream = ::svt::ImageResourceAccess::getImageXStream( getORB(), _rURL );
+ }
+diff --git forms/source/component/clickableimage.cxx forms/source/component/clickableimage.cxx
+index 2a3e691..9c6a478 100644
+--- forms/source/component/clickableimage.cxx
++++ forms/source/component/clickableimage.cxx
+@@ -705,6 +705,9 @@ namespace frm
+ void OClickableImageBaseModel::StartProduction()
+ {
+ ImageProducer *pImgProd = GetImageProducer();
++ // grab the ImageURL
++ rtl::OUString sURL;
++ getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ) ) >>= sURL;
+ if (!m_pMedium)
+ {
+ // caution: the medium may be NULL if somebody gave us a invalid URL to work with
+@@ -713,7 +716,6 @@ namespace frm
+ m_bDownloading = sal_False;
+ return;
+ }
+-
+ if (m_pMedium->GetErrorCode()==0)
+ {
+ SvStream* pStream = m_pMedium->GetInStream();
+@@ -722,7 +724,29 @@ namespace frm
+ pImgProd->startProduction();
+ m_bProdStarted = sal_True;
+ }
+- else
++ else if ( sURL.indexOf( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.GraphicObject:") ) == 0 ) )
++ {
++ // This is a bit of a hack, but I can't see a reason why using
++ // SfxMedium [*] is necessary here ( for GraphicObject scheme
++ // objects )
++ // We will get here if we have a vnd.sun.star.GraphicObject:xxxxx
++ // object ( the test above will fail because the SfxMedium can't
++ // handle 'em )
++ // Is the SfxMedium use just to handle say external links ( ftp etc. )
++ // and notify when they are read?
++ //
++ // [*] we could always convert the "vnd.sun.star.GraphicObject:xxx
++ // url to a "vnd.sun.star.Package:xxx" type url. Or we even could
++ // have another property at the controlmodel for that ( like Shapes
++ // do ). Using a "vnd.sun.star.Package:" in theory would be possible
++ // with the SfxMedium class ( assuming we can access the document's
++ // XStorage
++ pImgProd->SetImage(sURL);
++ pImgProd->startProduction();
++ m_bProdStarted = sal_True;
++ }
++
++ else
+ {
+ pImgProd->SetImage(String());
+ delete m_pMedium;
+diff --git forms/source/component/imgprod.cxx forms/source/component/imgprod.cxx
+index 01fa8ac..96882b3 100644
+--- forms/source/component/imgprod.cxx
++++ forms/source/component/imgprod.cxx
+@@ -267,7 +267,7 @@ void ImageProducer::SetImage( const ::rt
+ mbAsync = sal_False;
+ delete mpStm;
+
+- if ( ::svt::ImageResourceAccess::isImageResourceURL( maURL ) )
++ if ( ::svt::ImageResourceAccess::isImageResourceURL( maURL ) || maURL.compareToAscii( UNO_NAME_GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( UNO_NAME_GRAPHOBJ_URLPREFIX ) ) == 0 )
+ {
+ mpStm = ::svt::ImageResourceAccess::getImageStream( ::comphelper::getProcessServiceFactory(), maURL );
+ }
+diff --git forms/source/component/imgprod.hxx forms/source/component/imgprod.hxx
+index 6dc6235..e7ab6d0 100644
+--- forms/source/component/imgprod.hxx
++++ forms/source/component/imgprod.hxx
+@@ -40,6 +40,7 @@
+ #include <com/sun/star/lang/XInitialization.hpp>
+ #include <cppuhelper/weak.hxx>
+
++#define UNO_NAME_GRAPHOBJ_URLPREFIX "vnd.sun.star.GraphicObject:"
+
+ // -----------------
+ // - 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]