View | Details | Raw Unified | Return to issue 38215
Collapse All | Expand All

(-)extensions/source/propctrlr/formcomponenthandler.cxx (-10 / +48 lines)
Lines 80-85 Link Here
80
#include <com/sun/star/inspection/PropertyLineElement.hpp>
80
#include <com/sun/star/inspection/PropertyLineElement.hpp>
81
#include <com/sun/star/resource/XStringResourceManager.hpp>
81
#include <com/sun/star/resource/XStringResourceManager.hpp>
82
#include <com/sun/star/resource/MissingResourceException.hpp>
82
#include <com/sun/star/resource/MissingResourceException.hpp>
83
#include <com/sun/star/graphic/GraphicObject.hpp>
83
/** === end UNO includes === **/
84
/** === end UNO includes === **/
84
#include <connectivity/dbexception.hxx>
85
#include <connectivity/dbexception.hxx>
85
#include <vcl/wrkwin.hxx>
86
#include <vcl/wrkwin.hxx>
Lines 116-121 Link Here
116
117
117
#include <limits>
118
#include <limits>
118
119
120
#define GRAPHOBJ_URLPREFIX "vnd.sun.star.GraphicObject:"
119
//------------------------------------------------------------------------
121
//------------------------------------------------------------------------
120
extern "C" void SAL_CALL createRegistryInfo_FormComponentPropertyHandler()
122
extern "C" void SAL_CALL createRegistryInfo_FormComponentPropertyHandler()
121
{
123
{
Lines 336-342 namespace pcr Link Here
336
        ::osl::MutexGuard aGuard( m_aMutex );
338
        ::osl::MutexGuard aGuard( m_aMutex );
337
        PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) ); // check if property is known by the handler
339
        PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) ); // check if property is known by the handler
338
340
339
        if ( PROPERTY_ID_FONT_NAME == nPropId )
341
        Reference< graphic::XGraphicObject > xGrfObj;
342
        if ( PROPERTY_ID_IMAGE_URL == nPropId && ( _rValue >>= xGrfObj ) )
343
        {
344
            DBG_ASSERT( xGrfObj.is(), "FormComponentPropertyHandler::setPropertyValue() xGrfObj is invalid");
345
            rtl::OUString sObjectID( RTL_CONSTASCII_USTRINGPARAM( GRAPHOBJ_URLPREFIX ) );
346
            sObjectID = sObjectID + xGrfObj->getUniqueID();
347
            m_xComponent->setPropertyValue( _rPropertyName, uno::makeAny( sObjectID ) );
348
        }
349
        else if ( PROPERTY_ID_FONT_NAME == nPropId )
340
        {
350
        {
341
            // special handling, the value is a faked value we generated ourself in impl_executeFontDialog_nothrow
351
            // special handling, the value is a faked value we generated ourself in impl_executeFontDialog_nothrow
342
            Sequence< NamedValue > aFontPropertyValues;
352
            Sequence< NamedValue > aFontPropertyValues;
Lines 561-569 namespace pcr Link Here
561
        {
571
        {
562
            ::rtl::OUString sControlValue;
572
            ::rtl::OUString sControlValue;
563
            OSL_VERIFY( _rControlValue >>= sControlValue );
573
            OSL_VERIFY( _rControlValue >>= sControlValue );
564
574
            // Don't convert a placeholder
565
            INetURLObject aDocURL( impl_getDocumentURL_nothrow() );
575
            if ( nPropId == PROPERTY_ID_IMAGE_URL && sControlValue.equals( String( PcrRes( RID_EMBED_IMAGE_PLACEHOLDER ) ) ) )
566
            aPropertyValue <<= (::rtl::OUString)URIHelper::SmartRel2Abs( aDocURL, sControlValue, Link(), false, true, INetURLObject::WAS_ENCODED, INetURLObject::DECODE_TO_IURI );
576
                aPropertyValue <<= sControlValue;
577
            else
578
            {
579
                INetURLObject aDocURL( impl_getDocumentURL_nothrow() );
580
                aPropertyValue <<= (::rtl::OUString)URIHelper::SmartRel2Abs( aDocURL, sControlValue, Link(), false, true, INetURLObject::WAS_ENCODED, INetURLObject::DECODE_TO_IURI );
581
            }
567
        }
582
        }
568
        break;
583
        break;
569
584
Lines 2658-2669 namespace pcr Link Here
2658
    //------------------------------------------------------------------------
2673
    //------------------------------------------------------------------------
2659
    bool FormComponentPropertyHandler::impl_browseForImage_nothrow( Any& _out_rNewValue, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const
2674
    bool FormComponentPropertyHandler::impl_browseForImage_nothrow( Any& _out_rNewValue, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const
2660
    {
2675
    {
2676
        bool bIsLink = true;// reflect the legacy behavior
2661
        ::rtl::OUString aStrTrans = m_pInfoService->getPropertyTranslation( PROPERTY_ID_IMAGE_URL );
2677
        ::rtl::OUString aStrTrans = m_pInfoService->getPropertyTranslation( PROPERTY_ID_IMAGE_URL );
2662
2678
2663
        ::sfx2::FileDialogHelper aFileDlg(SFXWB_GRAPHIC);
2679
        ::sfx2::FileDialogHelper aFileDlg(SFXWB_GRAPHIC);
2664
2680
2665
        aFileDlg.SetTitle(aStrTrans);
2681
        aFileDlg.SetTitle(aStrTrans);
2666
2682
        // non-linked images ( e.g. those located in the document 
2683
        // stream ) cannot *currently* be handled by openoffice basic dialogs. 
2684
        bool bHandleNonLink = ( m_eComponentClass == eFormControl );
2685
        
2667
        Reference< XFilePickerControlAccess > xController(aFileDlg.GetFilePicker(), UNO_QUERY);
2686
        Reference< XFilePickerControlAccess > xController(aFileDlg.GetFilePicker(), UNO_QUERY);
2668
        DBG_ASSERT(xController.is(), "FormComponentPropertyHandler::impl_browseForImage_nothrow: missing the controller interface on the file picker!");
2687
        DBG_ASSERT(xController.is(), "FormComponentPropertyHandler::impl_browseForImage_nothrow: missing the controller interface on the file picker!");
2669
        if (xController.is())
2688
        if (xController.is())
Lines 2671-2684 namespace pcr Link Here
2671
            // do a preview by default
2690
            // do a preview by default
2672
            xController->setValue(ExtendedFilePickerElementIds::CHECKBOX_PREVIEW, 0, ::cppu::bool2any(sal_True));
2691
            xController->setValue(ExtendedFilePickerElementIds::CHECKBOX_PREVIEW, 0, ::cppu::bool2any(sal_True));
2673
2692
2674
            // "as link" is checked, but disabled
2693
            xController->setValue(ExtendedFilePickerElementIds::CHECKBOX_LINK, 0, ::cppu::bool2any(bIsLink));
2675
            xController->setValue(ExtendedFilePickerElementIds::CHECKBOX_LINK, 0, ::cppu::bool2any(sal_True));
2694
            xController->enableControl(ExtendedFilePickerElementIds::CHECKBOX_LINK, bHandleNonLink );
2676
            xController->enableControl(ExtendedFilePickerElementIds::CHECKBOX_LINK, sal_False);
2695
2677
        }
2696
        }
2678
2697
2679
        ::rtl::OUString sCurValue;
2698
        ::rtl::OUString sCurValue;
2680
        OSL_VERIFY( impl_getPropertyValue_throw( PROPERTY_IMAGE_URL ) >>= sCurValue );
2699
        OSL_VERIFY( impl_getPropertyValue_throw( PROPERTY_IMAGE_URL ) >>= sCurValue );
2681
        if ( sCurValue.getLength() != 0 )
2700
        if ( sCurValue.getLength() != 0 && sCurValue.compareToAscii(GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH(GRAPHOBJ_URLPREFIX) ) != 0 )
2682
        {
2701
        {
2683
            aFileDlg.SetDisplayDirectory( sCurValue );
2702
            aFileDlg.SetDisplayDirectory( sCurValue );
2684
            // TODO: need to set the display directory _and_ the default name
2703
            // TODO: need to set the display directory _and_ the default name
Lines 2687-2693 namespace pcr Link Here
2687
        _rClearBeforeDialog.clear();
2706
        _rClearBeforeDialog.clear();
2688
        bool bSuccess = ( 0 == aFileDlg.Execute() );
2707
        bool bSuccess = ( 0 == aFileDlg.Execute() );
2689
        if ( bSuccess )
2708
        if ( bSuccess )
2690
            _out_rNewValue <<= (::rtl::OUString)aFileDlg.GetPath();
2709
        {
2710
            if ( bHandleNonLink && xController.is() )
2711
            {
2712
                xController->getValue(ExtendedFilePickerElementIds::CHECKBOX_LINK, 0) >>= bIsLink;
2713
            }
2714
            if ( !bIsLink )
2715
            {
2716
                Graphic aGraphic;
2717
                aFileDlg.GetGraphic( aGraphic );
2718
                
2719
                Reference< graphic::XGraphicObject > xGrfObj = graphic::GraphicObject::create( m_aContext.getUNOContext() );
2720
                xGrfObj->setGraphic( aGraphic.GetXGraphic() ); 
2721
                
2722
                
2723
                _out_rNewValue <<= xGrfObj;
2724
                 
2725
            }
2726
            else
2727
                _out_rNewValue <<= (::rtl::OUString)aFileDlg.GetPath();
2728
        }
2691
        return bSuccess;
2729
        return bSuccess;
2692
    }
2730
    }
2693
2731
(-)extensions/source/propctrlr/propcontroller.cxx (-2 / +15 lines)
Lines 1384-1389 namespace pcr Link Here
1384
	{
1384
	{
1385
		try
1385
		try
1386
		{
1386
		{
1387
            rtl::OUString sPlcHolder = String( PcrRes( RID_EMBED_IMAGE_PLACEHOLDER ) );
1388
            bool bIsPlaceHolderValue = false;
1389
1390
            if ( rName.equals( PROPERTY_IMAGE_URL ) )
1391
            {
1392
                // if the prop value is the PlaceHolder 
1393
                // can ignore it
1394
                rtl::OUString sVal;
1395
                _rValue >>= sVal;
1396
                if ( sVal.equals( sPlcHolder ) )
1397
                    bIsPlaceHolderValue = true;
1398
            }
1387
            m_sCommittingProperty = rName;
1399
            m_sCommittingProperty = rName;
1388
1400
1389
            bool bIsActuatingProperty = impl_isActuatingProperty_nothrow( rName );
1401
            bool bIsActuatingProperty = impl_isActuatingProperty_nothrow( rName );
Lines 1396-1403 namespace pcr Link Here
1396
            PropertyHandlerRef handler = impl_getHandlerForProperty_throw( rName );
1408
            PropertyHandlerRef handler = impl_getHandlerForProperty_throw( rName );
1397
1409
1398
			//////////////////////////////////////////////////////////////////////
1410
			//////////////////////////////////////////////////////////////////////
1399
			// set the value
1411
			// set the value ( only if it's not a placeholder )
1400
            handler->setPropertyValue( rName, _rValue );
1412
            if ( !bIsPlaceHolderValue )
1413
                handler->setPropertyValue( rName, _rValue );
1401
1414
1402
			//////////////////////////////////////////////////////////////////////
1415
			//////////////////////////////////////////////////////////////////////
1403
            // re-retrieve the value
1416
            // re-retrieve the value
(-)extensions/source/propctrlr/propres.src (+4 lines)
Lines 52-54 String RID_STR_HELP_SECTION_LABEL Link Here
52
{
52
{
53
	Text [ en-US ] = "Help";
53
	Text [ en-US ] = "Help";
54
};
54
};
55
String RID_EMBED_IMAGE_PLACEHOLDER
56
{
57
	Text [ en-US ] = "<Embedded-Image>";
58
};
(-)extensions/source/propctrlr/propresid.hrc (+1 lines)
Lines 46-50 Link Here
46
#define RID_STR_PROPPAGE_DATA				( RID_PROPCONTROLLER_START +  2 )
46
#define RID_STR_PROPPAGE_DATA				( RID_PROPCONTROLLER_START +  2 )
47
#define RID_STR_BOOL						( RID_PROPCONTROLLER_START +  3 )
47
#define RID_STR_BOOL						( RID_PROPCONTROLLER_START +  3 )
48
#define RID_STR_HELP_SECTION_LABEL          ( RID_PROPCONTROLLER_START +  4 )
48
#define RID_STR_HELP_SECTION_LABEL          ( RID_PROPCONTROLLER_START +  4 )
49
#define RID_EMBED_IMAGE_PLACEHOLDER          ( RID_PROPCONTROLLER_START +  5 )
49
50
50
#endif // EXTENSIONS_PROPRESID_HRC
51
#endif // EXTENSIONS_PROPRESID_HRC
(-)extensions/source/propctrlr/usercontrol.cxx (-4 / +11 lines)
Lines 42-48 Link Here
42
#include <svtools/zformat.hxx>
42
#include <svtools/zformat.hxx>
43
#include <connectivity/dbconversion.hxx>
43
#include <connectivity/dbconversion.hxx>
44
#include <com/sun/star/util/Time.hpp>
44
#include <com/sun/star/util/Time.hpp>
45
45
#include "modulepcr.hxx"
46
#include "propresid.hrc"
46
//............................................................................
47
//............................................................................
47
namespace pcr
48
namespace pcr
48
{
49
{
Lines 271-276 namespace pcr Link Here
271
        :OFileUrlControl_Base( PropertyControlType::Unknown, pParent, nWinStyle | WB_DROPDOWN )
272
        :OFileUrlControl_Base( PropertyControlType::Unknown, pParent, nWinStyle | WB_DROPDOWN )
272
    {
273
    {
273
        getTypedControlWindow()->SetDropDownLineCount( 10 );
274
        getTypedControlWindow()->SetDropDownLineCount( 10 );
275
        getTypedControlWindow()->SetPlaceHolder( String( PcrRes( RID_EMBED_IMAGE_PLACEHOLDER ) ) ) ;
274
    }
276
    }
275
277
276
	//------------------------------------------------------------------
278
	//------------------------------------------------------------------
Lines 282-289 namespace pcr Link Here
282
	void SAL_CALL OFileUrlControl::setValue( const Any& _rValue ) throw (IllegalTypeException, RuntimeException)
284
	void SAL_CALL OFileUrlControl::setValue( const Any& _rValue ) throw (IllegalTypeException, RuntimeException)
283
    {
285
    {
284
        ::rtl::OUString sURL;
286
        ::rtl::OUString sURL;
285
        if ( _rValue >>= sURL )
287
        if ( ( _rValue >>= sURL ) )
286
            getTypedControlWindow()->DisplayURL( sURL );
288
        {
289
            if ( sURL.indexOf( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.GraphicObject:"  ) ) ) == 0  )
290
                getTypedControlWindow()->DisplayURL( getTypedControlWindow()->GetPlaceHolder() );
291
            else
292
                getTypedControlWindow()->DisplayURL( sURL );
293
        }
287
        else
294
        else
288
            getTypedControlWindow()->SetText( String() );
295
            getTypedControlWindow()->SetText( String() );
289
    }
296
    }
Lines 293-299 namespace pcr Link Here
293
    {
300
    {
294
        Any aPropValue;
301
        Any aPropValue;
295
        if ( getTypedControlWindow()->GetText().Len() )
302
        if ( getTypedControlWindow()->GetText().Len() )
296
            aPropValue <<= (::rtl::OUString)getTypedControlWindow()->GetURL();
303
            	aPropValue <<= (::rtl::OUString)getTypedControlWindow()->GetURL();
297
        return aPropValue;
304
        return aPropValue;
298
    }
305
    }
299
306
(-)forms/source/component/ImageControl.cxx (-5 / +29 lines)
Lines 57-62 Link Here
57
#include <com/sun/star/io/NotConnectedException.hpp>
57
#include <com/sun/star/io/NotConnectedException.hpp>
58
#include <com/sun/star/beans/PropertyValue.hpp>
58
#include <com/sun/star/beans/PropertyValue.hpp>
59
#include <com/sun/star/graphic/XGraphic.hpp>
59
#include <com/sun/star/graphic/XGraphic.hpp>
60
#include <com/sun/star/graphic/GraphicObject.hpp>
60
#include <tools/urlobj.hxx>
61
#include <tools/urlobj.hxx>
61
#include <tools/stream.hxx>
62
#include <tools/stream.hxx>
62
#include <tools/debug.hxx>
63
#include <tools/debug.hxx>
Lines 353-361 sal_Bool OImageControlModel::handleNewImageURL( const ::rtl::OUString& _rURL, Va Link Here
353
    ::std::auto_ptr< SvStream > pImageStream;
354
    ::std::auto_ptr< SvStream > pImageStream;
354
    Reference< XInputStream > xImageStream;
355
    Reference< XInputStream > xImageStream;
355
356
356
    if ( ::svt::ImageResourceAccess::isImageResourceURL( _rURL ) )
357
    if ( ::svt::GraphicAccess::isSupportedURL( _rURL ) )
357
    {
358
    {
358
        xImageStream = ::svt::ImageResourceAccess::getImageXStream( getORB(), _rURL );
359
        xImageStream = ::svt::GraphicAccess::getImageXStream( getORB(), _rURL );
359
    }
360
    }
360
    else
361
    else
361
    {
362
    {
Lines 646-653 void OImageControlControl::implInsertGraphics() Link Here
646
		DBG_ASSERT( xController.is(), "OImageControlControl::implInsertGraphics: invalid file picker!" );
647
		DBG_ASSERT( xController.is(), "OImageControlControl::implInsertGraphics: invalid file picker!" );
647
		if ( xController.is() )
648
		if ( xController.is() )
648
		{
649
		{
650
			// we can only give the option to choose a non-linked
651
			// graphic if this control is not bound to a database
652
			// column i.e. if bHasField is false 
653
			// In either case, the 'Link' cb will be checked
654
			Reference<XPropertySet> xBoundField;
655
			if ( hasProperty( PROPERTY_BOUNDFIELD, xSet ) )
656
				xSet->getPropertyValue( PROPERTY_BOUNDFIELD ) >>= xBoundField;
657
			sal_Bool bHasField = xBoundField.is();
658
649
			xController->setValue(ExtendedFilePickerElementIds::CHECKBOX_PREVIEW, 0, ::cppu::bool2any(sal_True));
659
			xController->setValue(ExtendedFilePickerElementIds::CHECKBOX_PREVIEW, 0, ::cppu::bool2any(sal_True));
650
			xController->enableControl(ExtendedFilePickerElementIds::CHECKBOX_LINK, sal_False);
660
			xController->setValue(ExtendedFilePickerElementIds::CHECKBOX_LINK, 0, ::cppu::bool2any( true ) );
661
			xController->enableControl(ExtendedFilePickerElementIds::CHECKBOX_LINK, !bHasField );
651
		}
662
		}
652
663
653
		if ( ERRCODE_NONE == aDialog.Execute() )
664
		if ( ERRCODE_NONE == aDialog.Execute() )
Lines 655-662 void OImageControlControl::implInsertGraphics() Link Here
655
			// reset the url property in case it already has the value we're about to set - in this case
666
			// reset the url property in case it already has the value we're about to set - in this case
656
			// our propertyChanged would not get called without this.
667
			// our propertyChanged would not get called without this.
657
			implClearGraphics( sal_False );
668
			implClearGraphics( sal_False );
658
669
			sal_Bool bIsLink = sal_False;
659
			xSet->setPropertyValue( PROPERTY_IMAGE_URL, makeAny( ::rtl::OUString( aDialog.GetPath() ) ) );
670
			xController->getValue(ExtendedFilePickerElementIds::CHECKBOX_LINK, 0) >>= bIsLink;
671
			if ( !bIsLink )
672
			{
673
				Graphic aGraphic;
674
				aDialog.GetGraphic( aGraphic );
675
				                
676
				Reference< graphic::XGraphicObject > xGrfObj = graphic::GraphicObject::create( m_aContext.getUNOContext() );
677
				xGrfObj->setGraphic( aGraphic.GetXGraphic() );
678
				rtl::OUString sObjectID( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.GraphicObject:" ) );
679
				sObjectID = sObjectID + xGrfObj->getUniqueID();
680
				xSet->setPropertyValue( PROPERTY_IMAGE_URL, makeAny( ::rtl::OUString( sObjectID ) ) );
681
			}
682
			else
683
				xSet->setPropertyValue( PROPERTY_IMAGE_URL, makeAny( ::rtl::OUString( aDialog.GetPath() ) ) );
660
		}
684
		}
661
	}
685
	}
662
	catch(Exception&)
686
	catch(Exception&)
(-)forms/source/component/clickableimage.cxx (-7 / +14 lines)
Lines 52-58 Link Here
52
#include "services.hxx"
52
#include "services.hxx"
53
#include <comphelper/container.hxx>
53
#include <comphelper/container.hxx>
54
#include <comphelper/listenernotification.hxx>
54
#include <comphelper/listenernotification.hxx>
55
55
#include <svtools/imageresourceaccess.hxx>
56
#define LOCAL_URL_PREFIX	'#'
56
#define LOCAL_URL_PREFIX	'#'
57
57
58
//.........................................................................
58
//.........................................................................
Lines 705-719 namespace frm Link Here
705
    void OClickableImageBaseModel::StartProduction()
705
    void OClickableImageBaseModel::StartProduction()
706
    {
706
    {
707
        ImageProducer *pImgProd = GetImageProducer();
707
        ImageProducer *pImgProd = GetImageProducer();
708
        // grab the ImageURL
709
        rtl::OUString sURL;
710
        getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ) ) >>= sURL;       
708
        if (!m_pMedium)
711
        if (!m_pMedium)
709
        {
712
        {
710
            // caution: the medium may be NULL if somebody gave us a invalid URL to work with
713
            if ( ::svt::GraphicAccess::isSupportedURL( sURL )  )
711
            // 11/24/2000 - 79667 - FS
714
                pImgProd->SetImage( sURL );
712
            pImgProd->SetImage(String());
715
            else 
716
                // caution: the medium may be NULL if somebody gave us a invalid URL to work with
717
                // 11/24/2000 - 79667 - FS
718
                pImgProd->SetImage(String());
713
            m_bDownloading = sal_False;
719
            m_bDownloading = sal_False;
714
            return;
720
            return;
715
        }
721
        }
716
717
        if (m_pMedium->GetErrorCode()==0)
722
        if (m_pMedium->GetErrorCode()==0)
718
        {
723
        {
719
            SvStream* pStream = m_pMedium->GetInStream();
724
            SvStream* pStream = m_pMedium->GetInStream();
Lines 749-756 namespace frm Link Here
749
            // we treat an invalid URL like we would treat no URL
754
            // we treat an invalid URL like we would treat no URL
750
            return;
755
            return;
751
756
752
        if (rURL.getLength())
757
        if (rURL.getLength() && !::svt::GraphicAccess::isSupportedURL( rURL ) ) 
753
        {
758
       {
754
            if (m_pMedium)
759
            if (m_pMedium)
755
                delete m_pMedium;
760
                delete m_pMedium;
756
761
Lines 860-865 namespace frm Link Here
860
        }
865
        }
861
        else
866
        else
862
        {
867
        {
868
            if ( ::svt::GraphicAccess::isSupportedURL( rURL )  )
869
                GetImageProducer()->SetImage( rURL );
863
            GetImageProducer()->startProduction();
870
            GetImageProducer()->startProduction();
864
        }
871
        }
865
    }
872
    }
(-)forms/source/component/imgprod.cxx (-2 / +2 lines)
Lines 267-275 void ImageProducer::SetImage( const ::rtl::OUString& rPath ) Link Here
267
	mbAsync = sal_False;
267
	mbAsync = sal_False;
268
	delete mpStm;
268
	delete mpStm;
269
269
270
    if ( ::svt::ImageResourceAccess::isImageResourceURL( maURL ) )
270
    if ( ::svt::GraphicAccess::isSupportedURL( maURL ) )
271
    {
271
    {
272
        mpStm = ::svt::ImageResourceAccess::getImageStream( ::comphelper::getProcessServiceFactory(), maURL );
272
        mpStm = ::svt::GraphicAccess::getImageStream( ::comphelper::getProcessServiceFactory(), maURL );
273
    }
273
    }
274
    else if( maURL.getLength() )
274
    else if( maURL.getLength() )
275
	{
275
	{
(-)forms/source/inc/FormComponent.hxx (-1 lines)
Lines 89-95 Link Here
89
namespace frm
89
namespace frm
90
{
90
{
91
//.........................................................................
91
//.........................................................................
92
93
    // default tab index for components
92
    // default tab index for components
94
    const sal_Int16 FRM_DEFAULT_TABINDEX = 0;
93
    const sal_Int16 FRM_DEFAULT_TABINDEX = 0;
95
94
(-)goodies/source/unographic/graphicuno.cxx (-3 / +12 lines)
Lines 38-48 Link Here
38
#include "renderer.hxx"
38
#include "renderer.hxx"
39
39
40
#include <com/sun/star/registry/XRegistryKey.hpp>
40
#include <com/sun/star/registry/XRegistryKey.hpp>
41
#include "comphelper/servicedecl.hxx"
41
42
42
using namespace com::sun::star;
43
using namespace com::sun::star;
44
namespace sdecl = comphelper::service_decl;
43
45
44
namespace unographic {
46
namespace unographic {
45
47
extern sdecl::ServiceDecl const serviceDecl;
46
// --------------------
48
// --------------------
47
// - *_createInstance -
49
// - *_createInstance -
48
// --------------------
50
// --------------------
Lines 72-78 extern "C" void SAL_CALL component_getImplementationEnvironment( const sal_Char* Link Here
72
// - component_writeInfo -
74
// - component_writeInfo -
73
// -----------------------
75
// -----------------------
74
76
75
extern "C" sal_Bool SAL_CALL component_writeInfo( void* /*pServiceManager*/, void* pRegistryKey )
77
extern "C" sal_Bool SAL_CALL component_writeInfo( void* pServiceManager, void* pRegistryKey )
76
{
78
{
77
	sal_Bool bRet = sal_False;
79
	sal_Bool bRet = sal_False;
78
80
Lines 105-110 extern "C" sal_Bool SAL_CALL component_writeInfo( void* /*pServiceManager*/, voi Link Here
105
		    
107
		    
106
			for( i = 0; i < aServices.getLength(); i++ )
108
			for( i = 0; i < aServices.getLength(); i++ )
107
		        xNewKey->createKey( aServices.getConstArray()[ i ] );
109
		        xNewKey->createKey( aServices.getConstArray()[ i ] );
110
111
   			if ( !component_writeInfoHelper( reinterpret_cast< lang::XMultiServiceFactory* >( pServiceManager ), reinterpret_cast< registry::XRegistryKey* >( pRegistryKey ), serviceDecl ) )
112
				return false;
108
				
113
				
109
			bRet = true;
114
			bRet = true;
110
		}
115
		}
Lines 121-127 extern "C" sal_Bool SAL_CALL component_writeInfo( void* /*pServiceManager*/, voi Link Here
121
// - component_getFactory -
126
// - component_getFactory -
122
// ------------------------
127
// ------------------------
123
128
124
extern "C" void* SAL_CALL component_getFactory( const sal_Char* pImplName, void* pServiceManager, void* /*pRegistryKey*/ )
129
extern "C" void* SAL_CALL component_getFactory( const sal_Char* pImplName, void* pServiceManager, void* pRegistryKey )
125
{
130
{
126
	void * pRet = 0;
131
	void * pRet = 0;
127
	
132
	
Lines 153-159 extern "C" void* SAL_CALL component_getFactory( const sal_Char* pImplName, void* Link Here
153
			pRet = xFactory.get();
158
			pRet = xFactory.get();
154
		}
159
		}
155
	}
160
	}
161
	else 
162
    {
163
        pRet =  component_getFactoryHelper( pImplName, reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ),reinterpret_cast< registry::XRegistryKey* >( pRegistryKey ), serviceDecl );
156
164
165
    }
157
	return pRet;
166
	return pRet;
158
}
167
}
159
 
168
 
(-)goodies/source/unographic/graphicunofactory.cxx (+106 lines)
Line 0 Link Here
1
/*************************************************************************
2
 *
3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
 * 
5
 * Copyright 2008 by Sun Microsystems, Inc.
6
 *
7
 * OpenOffice.org - a multi-platform office productivity suite
8
 *
9
 * $RCSfile: graphicuno.cxx,v $
10
 * $Revision: 1.6 $
11
 *
12
 * This file is part of OpenOffice.org.
13
 *
14
 * OpenOffice.org is free software: you can redistribute it and/or modify
15
 * it under the terms of the GNU Lesser General Public License version 3
16
 * only, as published by the Free Software Foundation.
17
 *
18
 * OpenOffice.org is distributed in the hope that it will be useful,
19
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
 * GNU Lesser General Public License version 3 for more details
22
 * (a copy is included in the LICENSE file that accompanied this code).
23
 *
24
 * You should have received a copy of the GNU Lesser General Public License
25
 * version 3 along with OpenOffice.org.  If not, see
26
 * <http://www.openoffice.org/license.html>
27
 * for a copy of the LGPLv3 License.
28
 *
29
 ************************************************************************/
30
31
32
// MARKER(update_precomp.py): autogen include statement, do not remove
33
#include "precompiled_goodies.hxx"
34
#include <comphelper/servicedecl.hxx>
35
#include <cppuhelper/implbase1.hxx>
36
#include <com/sun/star/graphic/XGraphicObject.hpp>
37
#include <com/sun/star/lang/IllegalArgumentException.hpp>
38
#include "grfmgr.hxx"
39
40
using namespace com::sun::star;
41
42
namespace unographic {
43
44
typedef ::cppu::WeakImplHelper1< graphic::XGraphicObject > GObjectAccess_BASE;
45
 // Simple uno wrapper around the GraphicObject class to allow basic
46
 // access. ( and solves a horrible cyclic link problem between
47
 // goodies/toolkit/extensions )
48
class GObjectImpl : public GObjectAccess_BASE
49
{
50
     ::osl::Mutex m_aMutex;
51
     std::auto_ptr< GraphicObject > mpGObject;
52
public:
53
     GObjectImpl( uno::Sequence< uno::Any > const & args, uno::Reference< uno::XComponentContext > const & xComponentContext ) throw (uno::RuntimeException);
54
55
     // XGraphicObject
56
    virtual uno::Reference< graphic::XGraphic > SAL_CALL getGraphic() throw (uno::RuntimeException);
57
    virtual void SAL_CALL setGraphic( const uno::Reference< graphic::XGraphic >& _graphic ) throw (uno::RuntimeException);
58
    ::rtl::OUString SAL_CALL getUniqueID() throw (uno::RuntimeException);
59
};
60
61
GObjectImpl::GObjectImpl( uno::Sequence< uno::Any > const & args, uno::Reference< uno::XComponentContext > const & /*xComponentContext*/ ) throw (uno::RuntimeException)
62
{
63
    if ( args.getLength() == 1 )
64
    {
65
        rtl::OUString sId;
66
        if ( !( args[ 0 ] >>= sId ) || sId.getLength() == 0 )
67
            throw lang::IllegalArgumentException();
68
        ByteString bsId( sId.getStr(), RTL_TEXTENCODING_UTF8 ); 
69
        mpGObject.reset( new GraphicObject( bsId ) ); 
70
    }
71
    else
72
       mpGObject.reset( new GraphicObject() ); 
73
}
74
75
uno::Reference< graphic::XGraphic > SAL_CALL GObjectImpl::getGraphic() throw (uno::RuntimeException)
76
{
77
    ::osl::MutexGuard aGuard( m_aMutex );
78
    if ( !mpGObject.get() )
79
        throw uno::RuntimeException();
80
    return mpGObject->GetGraphic().GetXGraphic();
81
}
82
83
void SAL_CALL GObjectImpl::setGraphic( const uno::Reference< graphic::XGraphic >& _graphic ) throw (uno::RuntimeException)
84
{
85
    ::osl::MutexGuard aGuard( m_aMutex );
86
    if ( !mpGObject.get() )
87
        throw uno::RuntimeException();
88
    Graphic aGraphic( _graphic );
89
    mpGObject->SetGraphic( aGraphic );
90
}
91
92
::rtl::OUString SAL_CALL GObjectImpl::getUniqueID() throw (uno::RuntimeException)
93
{
94
    ::osl::MutexGuard aGuard( m_aMutex );
95
    rtl::OUString sId;
96
    if ( mpGObject.get() )
97
        sId = String( mpGObject->GetUniqueID().GetBuffer(), RTL_TEXTENCODING_ASCII_US );
98
    return sId;
99
}
100
101
102
namespace sdecl = comphelper::service_decl;
103
sdecl::class_<GObjectImpl, sdecl::with_args<true> > serviceBI;
104
extern sdecl::ServiceDecl const serviceDecl( serviceBI, "com.sun.star.graphic.GraphicObject", "com.sun.star.graphic.GraphicObject" );
105
106
}
(-)goodies/source/unographic/makefile.mk (+2 lines)
Lines 47-52 CXXFILES= \ Link Here
47
			provider.cxx			\
47
			provider.cxx			\
48
			graphic.cxx				\
48
			graphic.cxx				\
49
			renderer.cxx			\
49
			renderer.cxx			\
50
			graphicunofactory.cxx			\
50
			transformer.cxx
51
			transformer.cxx
51
52
52
SLOFILES=							\
53
SLOFILES=							\
Lines 55-60 SLOFILES= \ Link Here
55
			$(SLO)$/provider.obj	\
56
			$(SLO)$/provider.obj	\
56
			$(SLO)$/graphic.obj		\
57
			$(SLO)$/graphic.obj		\
57
			$(SLO)$/renderer.obj	\
58
			$(SLO)$/renderer.obj	\
59
			$(SLO)$/graphicunofactory.obj	\
58
			$(SLO)$/transformer.obj
60
			$(SLO)$/transformer.obj
59
61
60
# --- Target -------------------------------------------------------
62
# --- Target -------------------------------------------------------
(-)goodies/source/unographic/provider.cxx (-1 / +26 lines)
Lines 54-65 Link Here
54
54
55
#include "descriptor.hxx"
55
#include "descriptor.hxx"
56
#include "graphic.hxx"
56
#include "graphic.hxx"
57
#include "grfmgr.hxx"
57
#include "provider.hxx"
58
#include "provider.hxx"
58
59
59
using namespace com::sun::star;
60
using namespace com::sun::star;
60
61
61
namespace unographic {
62
namespace unographic {
62
63
64
#define UNO_NAME_GRAPHOBJ_URLPREFIX                             "vnd.sun.star.GraphicObject:"
65
63
// -------------------
66
// -------------------
64
// - GraphicProvider -
67
// - GraphicProvider -
65
// -------------------
68
// -------------------
Lines 159-164 uno::Sequence< sal_Int8 > SAL_CALL GraphicProvider::getImplementationId() Link Here
159
162
160
// ------------------------------------------------------------------------------
163
// ------------------------------------------------------------------------------
161
164
165
uno::Reference< ::graphic::XGraphic > GraphicProvider::implLoadGraphicObject( const ::rtl::OUString& rResourceURL ) const
166
{
167
	uno::Reference< ::graphic::XGraphic > 	xRet;
168
	if( rResourceURL.compareToAscii( UNO_NAME_GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( UNO_NAME_GRAPHOBJ_URLPREFIX ) ) == 0 ) 
169
	{
170
		// graphic manager url
171
		String aTmpStr( rResourceURL.copy( sizeof( UNO_NAME_GRAPHOBJ_URLPREFIX ) - 1 ) );
172
		ByteString aUniqueID( aTmpStr, RTL_TEXTENCODING_UTF8 );
173
		GraphicObject aGrafObj( aUniqueID );	
174
		// I don't call aGrafObj.GetXGraphic because it will call us back 		
175
		// into implLoadMemory ( with "private:memorygraphic" test )
176
		::unographic::Graphic* pUnoGraphic = new ::unographic::Graphic;
177
		pUnoGraphic->init( aGrafObj.GetGraphic() );
178
		xRet = pUnoGraphic;
179
	}
180
	return xRet;
181
}
182
162
uno::Reference< ::graphic::XGraphic > GraphicProvider::implLoadMemory( const ::rtl::OUString& rResourceURL ) const
183
uno::Reference< ::graphic::XGraphic > GraphicProvider::implLoadMemory( const ::rtl::OUString& rResourceURL ) const
163
{
184
{
164
	uno::Reference< ::graphic::XGraphic > 	xRet;
185
	uno::Reference< ::graphic::XGraphic > 	xRet;
Lines 382-390 uno::Reference< beans::XPropertySet > SAL_CALL GraphicProvider::queryGraphicDesc Link Here
382
	else if( aURL.getLength() )
403
	else if( aURL.getLength() )
383
	{
404
	{
384
		uno::Reference< ::graphic::XGraphic > xGraphic( implLoadMemory( aURL ) );
405
		uno::Reference< ::graphic::XGraphic > xGraphic( implLoadMemory( aURL ) );
385
		
386
		if( !xGraphic.is() )
406
		if( !xGraphic.is() )
387
			xGraphic = implLoadResource( aURL );
407
			xGraphic = implLoadResource( aURL );
408
		if( !xGraphic.is() )
409
			xGraphic = implLoadGraphicObject( aURL );
388
410
389
        if ( !xGraphic.is() )
411
        if ( !xGraphic.is() )
390
            xGraphic = implLoadRepositoryImage( aURL );
412
            xGraphic = implLoadRepositoryImage( aURL );
Lines 453-458 uno::Reference< ::graphic::XGraphic > SAL_CALL GraphicProvider::queryGraphic( co Link Here
453
	else if( aPath.Len() )
475
	else if( aPath.Len() )
454
	{
476
	{
455
		xRet = implLoadMemory( aPath );
477
		xRet = implLoadMemory( aPath );
478
479
		if( !xRet.is() )
480
			xRet = implLoadGraphicObject( aPath );
456
		
481
		
457
		if( !xRet.is() )
482
		if( !xRet.is() )
458
			xRet = implLoadResource( aPath );
483
			xRet = implLoadResource( aPath );
(-)goodies/source/unographic/provider.hxx (+1 lines)
Lines 73-78 protected: Link Here
73
private:
73
private:
74
74
75
	::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > implLoadMemory( const ::rtl::OUString& rResourceURL ) const;
75
	::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > implLoadMemory( const ::rtl::OUString& rResourceURL ) const;
76
	::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > implLoadGraphicObject( const ::rtl::OUString& rResourceURL ) const;
76
	::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > implLoadResource( const ::rtl::OUString& rResourceURL ) const;
77
	::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > implLoadResource( const ::rtl::OUString& rResourceURL ) const;
77
	::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > implLoadRepositoryImage( const ::rtl::OUString& rResourceURL ) const;
78
	::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > implLoadRepositoryImage( const ::rtl::OUString& rResourceURL ) const;
78
	::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > implLoadBitmap( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap >& rBitmap ) const;
79
	::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > implLoadBitmap( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap >& rBitmap ) const;
(-)offapi/com/sun/star/graphic/GraphicObject.idl (+63 lines)
Line 0 Link Here
1
/*************************************************************************
2
 *
3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
 * 
5
 * Copyright 2008 by Sun Microsystems, Inc.
6
 *
7
 * OpenOffice.org - a multi-platform office productivity suite
8
 *
9
 * $RCSfile: GraphicProvider.idl,v $
10
 * $Revision: 1.5 $
11
 *
12
 * This file is part of OpenOffice.org.
13
 *
14
 * OpenOffice.org is free software: you can redistribute it and/or modify
15
 * it under the terms of the GNU Lesser General Public License version 3
16
 * only, as published by the Free Software Foundation.
17
 *
18
 * OpenOffice.org is distributed in the hope that it will be useful,
19
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
 * GNU Lesser General Public License version 3 for more details
22
 * (a copy is included in the LICENSE file that accompanied this code).
23
 *
24
 * You should have received a copy of the GNU Lesser General Public License
25
 * version 3 along with OpenOffice.org.  If not, see
26
 * <http://www.openoffice.org/license.html>
27
 * for a copy of the LGPLv3 License.
28
 *
29
 ************************************************************************/
30
31
#ifndef com_sun_star_graphic_GraphicObject_idl
32
#define com_sun_star_graphic_GraphicObject_idl
33
34
#include <com/sun/star/graphic/XGraphicObject.idl>
35
36
module com { module sun { module star { module graphic
37
{
38
/** The <type>GraphicObject</type> service can be used to create <type>XGraphicObject</type> instances.
39
<p>
40
<type>XGraphicObject</type> objects are accessable using GraphicObject scheme urls like <code>vnd.sun.star.GraphicObject:10000000000001940000012FB99807BD</code>
41
As long as at least one instance of <type>XGraphicObject</type> with a particular UniqueID exists, the associated image/graphic is available.
42
    @see GraphicObject
43
    @see GraphicProvider 
44
    @see MediaProperties 
45
</p>
46
*/
47
48
service GraphicObject : XGraphicObject
49
{
50
    /** Creates an <type>GraphicObject</type>
51
    */
52
53
    create();
54
    /** Creates an <type>GraphicObject</type> with <code>uniqueId</code>
55
	 @param uniqueId 
56
		If another <type>XGraphicObject</type> with <code>uniqueId</code> exists, this GraphicObject is populated with the other <type>GraphicObject</type>'s data.
57
    */
58
    createWithId( [in] string uniqueId );
59
};
60
61
} ; } ; } ; } ; 
62
63
#endif
(-)offapi/com/sun/star/graphic/MediaProperties.idl (-1 / +5 lines)
Lines 61-71 published service MediaProperties Link Here
61
			<li>private:resource/projectshortname/imagelist/12345</li>
61
			<li>private:resource/projectshortname/imagelist/12345</li>
62
			<li>private:resource/projectshortname/imagelist/12345/12</li>
62
			<li>private:resource/projectshortname/imagelist/12345/12</li>
63
		</ul>
63
		</ul>
64
And additionally, GraphicObject scheme url's like 
65
            <ul> <li>vnd.sun.star.GraphicObject:10000000000001940000012FB99807BD</li> </ul>
66
              can be used to access graphics held by the GraphicCache implementation. 
64
        </p>
67
        </p>
65
68
66
        <p>Yet more, you can access graphics in the application-wide image
69
        <p>Yet more, you can access graphics in the application-wide image
67
        repository by specifying URLs of the form
70
        repository by specifying URLs of the form
68
        <code>private:graphicrepository/<em>&lt;path_in_repository&gt;</em></code>.</p>
71
        <code>private:graphicrepository/<em>&lt;path_in_repository&gt;</em></code>. 
72
</p>
69
	*/
73
	*/
70
	[optional, property ] string URL;
74
	[optional, property ] string URL;
71
75
(-)offapi/com/sun/star/graphic/XGraphicObject.idl (+63 lines)
Line 0 Link Here
1
/*************************************************************************
2
 *
3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
 * 
5
 * Copyright 2008 by Sun Microsystems, Inc.
6
 *
7
 * OpenOffice.org - a multi-platform office productivity suite
8
 *
9
 * $RCSfile: XGraphic.idl,v $
10
 * $Revision: 1.5 $
11
 *
12
 * This file is part of OpenOffice.org.
13
 *
14
 * OpenOffice.org is free software: you can redistribute it and/or modify
15
 * it under the terms of the GNU Lesser General Public License version 3
16
 * only, as published by the Free Software Foundation.
17
 *
18
 * OpenOffice.org is distributed in the hope that it will be useful,
19
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
 * GNU Lesser General Public License version 3 for more details
22
 * (a copy is included in the LICENSE file that accompanied this code).
23
 *
24
 * You should have received a copy of the GNU Lesser General Public License
25
 * version 3 along with OpenOffice.org.  If not, see
26
 * <http://www.openoffice.org/license.html>
27
 * for a copy of the LGPLv3 License.
28
 *
29
 ************************************************************************/
30
31
#ifndef com_sun_star_graphic_XGraphicObject_idl
32
#define com_sun_star_graphic_XGraphicObject_idl
33
34
#include <com/sun/star/uno/XInterface.idl>
35
36
module com { module sun { module star { module graphic
37
{
38
interface XGraphic;
39
/** <p>
40
    <type>XGraphicObject</type> objects represent in-memory image and graphic
41
    objects. Such objects are accessable using GraphicObject scheme urls like
42
<ul> <li>vnd.sun.star.GraphicObject:10000000000001940000012FB99807BD</li> </ul>
43
 The numeric portion of the url is formed from <member>UniqueID</member>. As long as at least one instance of <type>XGraphicObject</type> with a particular UniqueID exists, the associated image/graphic is available.
44
    @see XGraphicObject
45
    @see GraphicProvider 
46
    @see MediaProperties 
47
    </p>
48
*/
49
50
interface XGraphicObject : ::com::sun::star::uno::XInterface
51
{
52
    /** is the associated image/graphic for this object.
53
    */
54
55
    [attribute ] XGraphic Graphic;
56
    /** is the id that can be used to form the <code>vnd.sun.star.GraphicObject:</code> url to address this object. 
57
    */
58
    [attribute, readonly ] string UniqueID;
59
};
60
61
} ; } ; } ; } ; 
62
63
#endif
(-)offapi/com/sun/star/graphic/makefile.mk (+2 lines)
Lines 53-58 IDLFILES= \ Link Here
53
	XGraphic.idl \
53
	XGraphic.idl \
54
	XGraphicProvider.idl \
54
	XGraphicProvider.idl \
55
	XGraphicRenderer.idl \
55
	XGraphicRenderer.idl \
56
	XGraphicObject.idl \
57
	GraphicObject.idl \
56
	XGraphicTransformer.idl
58
	XGraphicTransformer.idl
57
	
59
	
58
# --- Targets ------------------------------------------------------
60
# --- Targets ------------------------------------------------------
(-)svtools/inc/imageresourceaccess.hxx (-6 / +7 lines)
Lines 45-66 namespace svt Link Here
45
//........................................................................
45
//........................................................................
46
46
47
    //====================================================================
47
    //====================================================================
48
    //= ImageResourceAccess
48
    //= GraphicAccess
49
    //====================================================================
49
    //====================================================================
50
    /** helper class for obtaining streams (which also can be used with the ImageProducer)
50
    /** helper class for obtaining streams (which also can be used with the ImageProducer)
51
        from a resource
51
        from a resource
52
    */
52
    */
53
    class ImageResourceAccess
53
    class GraphicAccess
54
    {
54
    {
55
    private:
55
    private:
56
        ImageResourceAccess();    // never implemented
56
        GraphicAccess();    // never implemented
57
57
58
    public:
58
    public:
59
        /** determines whether the given URL denotes an image within a resource
59
        /** determines whether the given URL denotes an image within a resource
60
         ( or an image specified by a vnd.sun.star.GraphicObject scheme URL )
60
        */
61
        */
61
        SVT_DLLPUBLIC static  bool        isImageResourceURL( const ::rtl::OUString& _rURL );
62
        SVT_DLLPUBLIC static  bool        isSupportedURL( const ::rtl::OUString& _rURL );
62
63
63
        /** for a given URL of an image within a resource, this method retrieves
64
        /** for a given URL of an image within a resource ( or an image specified by a vnd.sun.star.GraphicObject scheme URL ), this method retrieves
64
            an SvStream for this image.
65
            an SvStream for this image.
65
66
66
            This method works for arbitrary URLs denoting an image, since the
67
            This method works for arbitrary URLs denoting an image, since the
Lines 74-80 namespace svt Link Here
74
                    const ::rtl::OUString& _rImageResourceURL
75
                    const ::rtl::OUString& _rImageResourceURL
75
                );
76
                );
76
77
77
        /** for a given URL of an image within a resource, this method retrieves
78
        /** for a given URL of an image within a resource ( or an image specified by a vnd.sun.star.GraphicObject scheme URL ), this method retrieves
78
            an <type scope="com::sun::star::io">XInputStream</type> for this image.
79
            an <type scope="com::sun::star::io">XInputStream</type> for this image.
79
        */
80
        */
80
        SVT_DLLPUBLIC static  ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
81
        SVT_DLLPUBLIC static  ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
(-)svtools/inc/svtools/inettbc.hxx (+4 lines)
Lines 50-55 friend class SvtMatchContext_Impl; Link Here
50
friend class SvtURLBox_Impl;
50
friend class SvtURLBox_Impl;
51
	Link							aOpenHdl;
51
	Link							aOpenHdl;
52
	String							aBaseURL;
52
	String							aBaseURL;
53
	String							aPlaceHolder;
53
	SvtMatchContext_Impl*			pCtx;
54
	SvtMatchContext_Impl*			pCtx;
54
	SvtURLBox_Impl*					pImp;
55
	SvtURLBox_Impl*					pImp;
55
	INetProtocol					eSmartProtocol;
56
	INetProtocol					eSmartProtocol;
Lines 104-109 public: Link Here
104
105
105
    inline void                     EnableAutocompletion( BOOL _bEnable = TRUE )
106
    inline void                     EnableAutocompletion( BOOL _bEnable = TRUE )
106
                                        { bIsAutoCompleteEnabled = _bEnable; }
107
                                        { bIsAutoCompleteEnabled = _bEnable; }
108
    void SetPlaceHolder( const String& sPlaceHolder ) { aPlaceHolder = sPlaceHolder; }
109
    String GetPlaceHolder() { return aPlaceHolder; }
110
    bool MatchesPlaceHolder( const String& sToMatch ) { return ( ( aPlaceHolder.Len() > 0 ) && ( aPlaceHolder == sToMatch ) ); }
107
};
111
};
108
112
109
#endif
113
#endif
(-)svtools/source/control/inettbc.cxx (+9 lines)
Lines 1079-1084 long SvtURLBox::PreNotify( NotifyEvent& rNEvt ) Link Here
1079
            SetSelection( Selection( nLen, GetText().Len() ) );
1079
            SetSelection( Selection( nLen, GetText().Len() ) );
1080
            return TRUE;
1080
            return TRUE;
1081
        }
1081
        }
1082
1083
        if ( MatchesPlaceHolder( GetText() ) )
1084
        {
1085
            // set the selection so a key stroke will overwrite
1086
            // the placeholder rather than edit it
1087
            SetSelection( Selection( 0, GetText().Len() ) );
1088
        }
1082
	}
1089
	}
1083
1090
1084
	return ComboBox::PreNotify( rNEvt );
1091
	return ComboBox::PreNotify( rNEvt );
Lines 1148-1153 String SvtURLBox::GetURL() Link Here
1148
    ::vos::OGuard aGuard( SvtMatchContext_Impl::GetMutex() );
1155
    ::vos::OGuard aGuard( SvtMatchContext_Impl::GetMutex() );
1149
1156
1150
    String aText( GetText() );
1157
    String aText( GetText() );
1158
	if ( MatchesPlaceHolder( aText ) )
1159
		return aPlaceHolder;
1151
    // try to get the right case preserving URL from the list of URLs
1160
    // try to get the right case preserving URL from the list of URLs
1152
    if ( pImp->pCompletions && pImp->pURLs )
1161
    if ( pImp->pCompletions && pImp->pURLs )
1153
    {
1162
    {
(-)svtools/source/misc/imageresourceaccess.cxx (-8 / +10 lines)
Lines 51-56 namespace svt Link Here
51
{
51
{
52
//........................................................................
52
//........................................................................
53
53
54
#define GRAPHOBJ_URLPREFIX "vnd.sun.star.GraphicObject:"
55
54
    using namespace ::utl;
56
    using namespace ::utl;
55
    using namespace ::comphelper;
57
    using namespace ::comphelper;
56
    using namespace ::com::sun::star::io;
58
    using namespace ::com::sun::star::io;
Lines 137-153 namespace svt Link Here
137
    }
139
    }
138
140
139
    //====================================================================
141
    //====================================================================
140
	//= ImageResourceAccess
142
	//= GraphicAccess
141
	//====================================================================
143
	//====================================================================
142
	//--------------------------------------------------------------------
144
	//--------------------------------------------------------------------
143
    bool ImageResourceAccess::isImageResourceURL( const ::rtl::OUString& _rURL )
145
    bool GraphicAccess::isSupportedURL( const ::rtl::OUString& _rURL )
144
    {
146
    {
145
        ::rtl::OUString sIndicator( RTL_CONSTASCII_USTRINGPARAM( "private:resource/" ) );
147
        ::rtl::OUString sIndicator( RTL_CONSTASCII_USTRINGPARAM( "private:resource/" ) );
146
        return _rURL.indexOf( sIndicator ) == 0;
148
        return ( ( _rURL.indexOf( sIndicator ) == 0 ) || ( _rURL.compareToAscii( GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( GRAPHOBJ_URLPREFIX ) ) == 0 ) );
147
    }
149
    }
148
150
149
	//--------------------------------------------------------------------
151
	//--------------------------------------------------------------------
150
    SvStream* ImageResourceAccess::getImageStream( const Reference< XMultiServiceFactory >& _rxORB, const ::rtl::OUString& _rImageResourceURL )
152
    SvStream* GraphicAccess::getImageStream( const Reference< XMultiServiceFactory >& _rxORB, const ::rtl::OUString& _rImageResourceURL )
151
    {
153
    {
152
        SvStream* pReturn = NULL;
154
        SvStream* pReturn = NULL;
153
155
Lines 157-163 namespace svt Link Here
157
            Reference< XGraphicProvider > xProvider;
159
            Reference< XGraphicProvider > xProvider;
158
            if ( _rxORB.is() )
160
            if ( _rxORB.is() )
159
                xProvider = xProvider.query( _rxORB->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.graphic.GraphicProvider" ) ) ) );
161
                xProvider = xProvider.query( _rxORB->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.graphic.GraphicProvider" ) ) ) );
160
            OSL_ENSURE( xProvider.is(), "ImageResourceAccess::getImageStream: could not create a graphic provider!" );
162
            OSL_ENSURE( xProvider.is(), "GraphicAccess::getImageStream: could not create a graphic provider!" );
161
163
162
            if ( !xProvider.is() )
164
            if ( !xProvider.is() )
163
                return pReturn;
165
                return pReturn;
Lines 167-173 namespace svt Link Here
167
            aMediaProperties[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) );
169
            aMediaProperties[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) );
168
            aMediaProperties[0].Value <<= _rImageResourceURL;
170
            aMediaProperties[0].Value <<= _rImageResourceURL;
169
            Reference< XGraphic > xGraphic( xProvider->queryGraphic( aMediaProperties ) );
171
            Reference< XGraphic > xGraphic( xProvider->queryGraphic( aMediaProperties ) );
170
            OSL_ENSURE( xGraphic.is(), "ImageResourceAccess::getImageStream: the provider did not give us a graphic object!" );
172
            OSL_ENSURE( xGraphic.is(), "GraphicAccess::getImageStream: the provider did not give us a graphic object!" );
171
            if ( !xGraphic.is() )
173
            if ( !xGraphic.is() )
172
                return pReturn;
174
                return pReturn;
173
175
Lines 190-203 namespace svt Link Here
190
        }
192
        }
191
        catch( const Exception& )
193
        catch( const Exception& )
192
        {
194
        {
193
        	OSL_ENSURE( sal_False, "ImageResourceAccess::getImageStream: caught an exception!" );
195
        	OSL_ENSURE( sal_False, "GraphicAccess::getImageStream: caught an exception!" );
194
        }
196
        }
195
197
196
        return pReturn;
198
        return pReturn;
197
    }
199
    }
198
200
199
	//--------------------------------------------------------------------
201
	//--------------------------------------------------------------------
200
    Reference< XInputStream > ImageResourceAccess::getImageXStream( const Reference< XMultiServiceFactory >& _rxORB, const ::rtl::OUString& _rImageResourceURL )
202
    Reference< XInputStream > GraphicAccess::getImageXStream( const Reference< XMultiServiceFactory >& _rxORB, const ::rtl::OUString& _rImageResourceURL )
201
    {
203
    {
202
        return new OSeekableInputStreamWrapper( getImageStream( _rxORB, _rImageResourceURL ), sal_True );   // take ownership
204
        return new OSeekableInputStreamWrapper( getImageStream( _rxORB, _rImageResourceURL ), sal_True );   // take ownership
203
    }
205
    }
(-)toolkit/inc/toolkit/controls/unocontrols.hxx (-1 / +7 lines)
Lines 54-59 Link Here
54
#include <com/sun/star/awt/XCurrencyField.hpp>
54
#include <com/sun/star/awt/XCurrencyField.hpp>
55
#include <com/sun/star/awt/XPatternField.hpp>
55
#include <com/sun/star/awt/XPatternField.hpp>
56
#include <com/sun/star/awt/XProgressBar.hpp>
56
#include <com/sun/star/awt/XProgressBar.hpp>
57
#include <com/sun/star/graphic/XGraphicObject.hpp>
57
#include <toolkit/controls/unocontrolmodel.hxx>
58
#include <toolkit/controls/unocontrolmodel.hxx>
58
#include <toolkit/controls/unocontrolbase.hxx>
59
#include <toolkit/controls/unocontrolbase.hxx>
59
#include <toolkit/helper/macros.hxx>
60
#include <toolkit/helper/macros.hxx>
Lines 67-72 Link Here
67
68
68
#include <list>
69
#include <list>
69
70
71
#define UNO_NAME_GRAPHOBJ_URLPREFIX                             "vnd.sun.star.GraphicObject:"
72
#define UNO_NAME_GRAPHOBJ_URLPKGPREFIX                  "vnd.sun.star.Package:"
73
 
70
74
71
//	----------------------------------------------------
75
//	----------------------------------------------------
72
//	class UnoControlEditModel
76
//	class UnoControlEditModel
Lines 219-225 private: Link Here
219
	std::list< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > >  maListeners;
223
	std::list< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > >  maListeners;
220
    bool                                                                                    mbAdjustingImagePosition;
224
    bool                                                                                    mbAdjustingImagePosition;
221
    bool                                                                                    mbAdjustingGraphic;
225
    bool                                                                                    mbAdjustingGraphic;
222
226
    
227
    ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphicObject > mxGrfObj;
228
    ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > getGraphicFromURL_nothrow( const ::rtl::OUString& _rURL );
223
protected:
229
protected:
224
    ImageProducerControlModel() : mbAdjustingImagePosition( false ), mbAdjustingGraphic( false ) { }
230
    ImageProducerControlModel() : mbAdjustingImagePosition( false ), mbAdjustingGraphic( false ) { }
225
    ImageProducerControlModel( const ImageProducerControlModel& _rSource ) : com::sun::star::awt::XImageProducer(), UnoControlModel( _rSource ), mbAdjustingImagePosition( false ), mbAdjustingGraphic( false ) { }
231
    ImageProducerControlModel( const ImageProducerControlModel& _rSource ) : com::sun::star::awt::XImageProducer(), UnoControlModel( _rSource ), mbAdjustingImagePosition( false ), mbAdjustingGraphic( false ) { }
(-)toolkit/source/controls/unocontrols.cxx (-5 / +15 lines)
Lines 37-42 Link Here
37
#include <com/sun/star/awt/VisualEffect.hpp>
37
#include <com/sun/star/awt/VisualEffect.hpp>
38
#include <com/sun/star/awt/LineEndFormat.hpp>
38
#include <com/sun/star/awt/LineEndFormat.hpp>
39
#include <com/sun/star/graphic/XGraphicProvider.hpp>
39
#include <com/sun/star/graphic/XGraphicProvider.hpp>
40
#include <com/sun/star/graphic/GraphicObject.hpp>
40
#include <com/sun/star/util/Date.hpp>
41
#include <com/sun/star/util/Date.hpp>
41
42
42
43
Lines 576-586 uno::Any ImageProducerControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) co Link Here
576
577
577
    return UnoControlModel::ImplGetDefaultValue( nPropId );
578
    return UnoControlModel::ImplGetDefaultValue( nPropId );
578
}
579
}
579
namespace
580
    uno::Reference< graphic::XGraphic > ImageProducerControlModel::getGraphicFromURL_nothrow( const ::rtl::OUString& _rURL )
580
{
581
    uno::Reference< graphic::XGraphic > lcl_getGraphicFromURL_nothrow( const ::rtl::OUString& _rURL )
582
    {
581
    {
583
        uno::Reference< graphic::XGraphic > xGraphic;
582
        uno::Reference< graphic::XGraphic > xGraphic;
583
584
        if( ( _rURL.compareToAscii( UNO_NAME_GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( UNO_NAME_GRAPHOBJ_URLPREFIX ) ) == 0 ) )
585
        {
586
            // graphic manager uniqueid
587
            rtl::OUString sID = _rURL.copy( sizeof( UNO_NAME_GRAPHOBJ_URLPREFIX ) - 1 );
588
            // get the DefaultContext
589
            ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
590
            mxGrfObj = graphic::GraphicObject::createWithId( aContext.getUNOContext(), sID );
591
        }
592
        else // linked
593
            mxGrfObj = NULL; // release the GraphicObject
594
584
        if ( !_rURL.getLength() )
595
        if ( !_rURL.getLength() )
585
            return xGraphic;
596
            return xGraphic;
586
597
Lines 603-609 namespace Link Here
603
614
604
        return xGraphic;
615
        return xGraphic;
605
    }
616
    }
606
}
607
617
608
void SAL_CALL ImageProducerControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception)
618
void SAL_CALL ImageProducerControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception)
609
{
619
{
Lines 621-627 void SAL_CALL ImageProducerControlModel::setFastPropertyValue_NoBroadcast( sal_I Link Here
621
                mbAdjustingGraphic = true;
631
                mbAdjustingGraphic = true;
622
                ::rtl::OUString sImageURL;
632
                ::rtl::OUString sImageURL;
623
                OSL_VERIFY( rValue >>= sImageURL );
633
                OSL_VERIFY( rValue >>= sImageURL );
624
                setPropertyValue( GetPropertyName( BASEPROPERTY_GRAPHIC ), uno::makeAny( lcl_getGraphicFromURL_nothrow( sImageURL ) ) );
634
                setPropertyValue( GetPropertyName( BASEPROPERTY_GRAPHIC ), uno::makeAny( getGraphicFromURL_nothrow( sImageURL ) ) );
625
                mbAdjustingGraphic = false;
635
                mbAdjustingGraphic = false;
626
            }
636
            }
627
            break;
637
            break;
(-)xmloff/source/forms/elementimport.cxx (-2 / +2 lines)
Lines 1133-1142 namespace xmloff Link Here
1133
					)
1133
					)
1134
				);
1134
				);
1135
1135
1136
		if ( bMakeAbsolute )
1136
		if ( bMakeAbsolute && ( _rValue.getLength() > 0  ) )
1137
		{
1137
		{
1138
			// make a global URL out of the local one
1138
			// make a global URL out of the local one
1139
			::rtl::OUString sAdjustedValue = m_rContext.getGlobalContext().GetAbsoluteReference( _rValue );
1139
			::rtl::OUString sAdjustedValue = m_rContext.getGlobalContext().ResolveGraphicObjectURL( _rValue, FALSE );
1140
			OImagePositionImport::handleAttribute( _nNamespaceKey, _rLocalName, sAdjustedValue );
1140
			OImagePositionImport::handleAttribute( _nNamespaceKey, _rLocalName, sAdjustedValue );
1141
		}
1141
		}
1142
		else
1142
		else
(-)xmloff/source/forms/propertyexport.cxx (-1 / +3 lines)
Lines 429-435 namespace xmloff Link Here
429
			
429
			
430
		::rtl::OUString sTargetLocation = comphelper::getString(m_xProps->getPropertyValue(_sPropertyName));
430
		::rtl::OUString sTargetLocation = comphelper::getString(m_xProps->getPropertyValue(_sPropertyName));
431
        if ( sTargetLocation.getLength() )
431
        if ( sTargetLocation.getLength() )
432
		    sTargetLocation = m_rContext.getGlobalContext().GetRelativeReference(sTargetLocation);
432
                    // If this isn't a GraphicObject then GetRelativeReference
433
                    // will be called anyway ( in AddEmbeddedGraphic )
434
		    sTargetLocation = m_rContext.getGlobalContext().AddEmbeddedGraphicObject(sTargetLocation);
433
		AddAttribute(OAttributeMetaData::getCommonControlAttributeNamespace(_nProperty)
435
		AddAttribute(OAttributeMetaData::getCommonControlAttributeNamespace(_nProperty)
434
					,OAttributeMetaData::getCommonControlAttributeName(_nProperty)
436
					,OAttributeMetaData::getCommonControlAttributeName(_nProperty)
435
					, sTargetLocation);
437
					, sTargetLocation);

Return to issue 38215